0

I am trying to load a csv file (`3000 rows) into python.

While importing it gives me some encoding decoding error.

However, I tried to change the encoding to utf-8; owing to some special characters in the name field of my data.

However, it still not works.

I am using the following code:

import pandas as pd
df= pd.read_csv("Checkin 2019.csv", encoding="utf-8")
print(df)

Can anyone help where I am going wrong?

rioV8
  • 24,506
  • 3
  • 32
  • 49

2 Answers2

0

FileNotFoundError is raised only when the file is not in the specified location. Try moving "Check in 2019.csv" file into the same directory where the python script is.

If there is encoding issue, try pd.read_csv('filename.csv', encoding = "ISO-8859-1", engine='python')

if it does not work try changing encoding to different parameters like latin, ANSI . On Linux, to determine encoding use file -i filename.

ssp4all
  • 371
  • 2
  • 11
0

Try checking that the file name is spelled correctly, if that does not work, check that the python file (something.py) or notebook (something.ipynb) is in the same folder or directory as your csv file. if they are not in the same file, you can specify the path to that file or move it to be in the same folder as your files

you can also do the following to find out which directory you are working on

import os
print(os.getcwd())

then move your .csv file into that directory that is printed

Command
  • 31
  • 6