0

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

3 Answers 3

1

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=';')
Sign up to request clarification or add additional context in comments.

Comments

1

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

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

Comments

1

The file is semicolon-separated and also decimal is comma, not dot

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

And Please do not upload images of code/data/errors..

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.