I want to load a space separated data into pandas dataframe. If I use sep='\s+'
, then I get the error CParserError: Error tokenizing data. C error: Expected 7 fields in line 5, saw 9
df = pd.read_table("data.rpt",sep='\s+',index_col=False)
I was able to open this file in Excel using space as a delimiter. How to solve this issue with pandas?
Fist lines of a file:
Id IdEvent Agent Sist Group Con CInt
-- ------- ----- ---- ----- --- ----
18 2016101 B0C XCX ROD F DC 0
19 2016101 A0C DCX APT AD 5
15 2016103 V0C XCX ROD S DC 0
16 2016102 N0C XCX ROD CD 0