Home > database >  Trouble reading CSV file using pandas
Trouble reading CSV file using pandas

Time:12-14

I'm working on a data analysis project & I wanted to read data from CSV files using pandas. I read the first CSV file and It was fine but the second one gave me a UTF 8 encoding error. I exported the file to csv and encoded it to UTF-8 in the numbers spreadsheet app. However, the data frame is not in the expected format. Any idea why? code in Jupyter notebook

the original CSV file in numbers the original CSV file in numbers

CodePudding user response:

Try adding the correct delimiter, in this case ";", to read the csv.

mitb = pd.read_csv('mitb.csv', sep=";")

CodePudding user response:

it looks like your file is semicolon separated not comma separated. To fix this you need to add the sep=';' parameter to pd.read_csv function.

pd.read_csv("mitb.csv", sep=';')
  • Related