I have a pandas DataFrame which can be summarized as this:
[Header]
Some_info = some_info
[Data]
Col1 Col2
0.532 Point
0.234 Point
0.123 Point
1.455 Square
14.64 Square
[Other data]
Other1 Other2
Test1 PASS
Test2 FAIL
My goal is to read only the portion of text between [Data]
and [Other data]
, which is variable (different length). The header has always the same length, so skiprows
from pandas.read_csv
can be used. However, skipfooter
needs the number of lines to skip, which can change between files.
What would be the best solution here? I would like to avoid altering the file externally unless there's no other solution.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…