pandas.read_csv报 ParserError: Error tokenizing data. C error: Expected 2 fields in line 134, saw 3

 Use pandas' read_csv to read the file separated by "\t" and report the following error. 

ParserError: Error tokenizing data. C error: Expected 2 fields in line 134, saw 3

The solution provided by someone on the Internet is: padans.csv_read function plus a parameter delimiter, as follows:

res = pd.read_csv(f,delimiter="\t")

 Of course, it does not solve the problem. After trying, the following code can be used to solve it, but the two columns of data will become one column. "\T" still exists in it.

train_df=pd.read_csv(filepath_or_buffer=path,sep="delimiter",encoding="utf-8",header=0,engine="python")

 

Guess you like

Origin blog.csdn.net/guyu1003/article/details/109030558