I am trying to read a csv encoded in utf-8 with a comma as separator but the dataframe is not separating any of the columns.
This is an example of the csv file
19,"Aero Biniza",\\N,"","BZS","BINIZA","Mexico","N"
The whole file is available here
https://raw.githubusercontent.com/jpatokal/openflights/master/data/airlines.dat
And this is my code
pd.read_csv(input_csv, encoding='utf-8')
I am probably doing something stupid but grateful if anyone can point it out.
CSV need a header to have columns be named by them, looks like the csv in the link does not have that.
In order to read a csv in that doesn't have a header you need to pass param header=None:
df = pd.read_csv(file_path, header=None)
See the docs
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.