How does python extract the inner subtables of the excel table?

problem description

use python to extract subtables of excel tables whose contents are unknown

similar to the red box part of the picture, how to complete the extraction of the child table of the red part according to the keyword configured in advance after reading the excel table.


< H2 > data Table < / H2 >

< H2 > related read code < / H2 >
</span>

"" ""

import pandas as pd

df = pd.read_excel("test.xlsx")
target_index = df.iloc[:,0].isin(["", ""]).index

res = df.iloc[target_index[0]:target_index[1],:]
res = res.rename(columns=res.iloc[0]).drop(res.index[0])

result:

Out[42]: 
0  col1 col2 col3
1  NaN  NaN  NaN  NaN
2  NaN  NaN  NaN  NaN
3  NaN  NaN  NaN  NaN
4  NaN  NaN  NaN  NaN
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-7c0279-2726c.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-7c0279-2726c.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?