Вы можете использовать read_fwf
:
str1 = """
Feature Id & Feature Desc Status Failed Total
--------------------------------------------------- -------- ------ -----
RKSPACE (RackSpace Test In) Passed 0 1
D1 (Drum 1 Test) Passed 0 1
D2 (Drum 2 Test) Passed 0 1
D3 (Drum 3 Test) Passed 0 1
PRIMUS (PRIMUS Ink Test) Not-run 0 0
RGB (RGB Color Test) Passed 0 1
YONO (App Test) Not-run 0 0
PSENSE (Paper Sensor Test) Not-run 0 0
TFlag (Flag Test) Not-run 0 0
MEMT (Memory Test) Passed 0 1
CRG (CARRIAGE Test) Not-run 0 0
"""
df = pd.read_fwf(pd.compat.StringIO(str1),
colspecs=[(0, 50), (51, 62), (63, 69), (70, 76)],
skiprows=[2],
header=[1])
print (df)
Feature Id & Feature Desc Status Failed Total
0 RKSPACE (RackSpace Test In) Passed 0 1
1 D1 (Drum 1 Test) Passed 0 1
2 D2 (Drum 2 Test) Passed 0 1
3 D3 (Drum 3 Test) Passed 0 1
4 PRIMUS (PRIMUS Ink Test) Not-run 0 0
5 RGB (RGB Color Test) Passed 0 1
6 YONO (App Test) Not-run 0 0
7 PSENSE (Paper Sensor Test) Not-run 0 0
8 TFlag (Flag Test) Not-run 0 0
9 MEMT (Memory Test) Passed 0 1
10 CRG (CARRIAGE Test) Not-run 0 0
Спасибо @gyoza за упрощенное решение:
df = pd.read_fwf(pd.compat.StringIO(str1),
skiprows=[2],
header=[1])
print (df)
Feature Id & Feature Desc Status Failed Total
0 RKSPACE (RackSpace Test In) Passed 0 1
1 D1 (Drum 1 Test) Passed 0 1
2 D2 (Drum 2 Test) Passed 0 1
3 D3 (Drum 3 Test) Passed 0 1
4 PRIMUS (PRIMUS Ink Test) Not-run 0 0
5 RGB (RGB Color Test) Passed 0 1
6 YONO (App Test) Not-run 0 0
7 PSENSE (Paper Sensor Test) Not-run 0 0
8 TFlag (Flag Test) Not-run 0 0
9 MEMT (Memory Test) Passed 0 1
10 CRG (CARRIAGE Test) Not-run 0 0