I am trying to load a .csv file lying on my desktop using pandas on jupyter notebook and getting the following error:
What's the problem with the code? The same method works on windows. (I'm using ubuntu 16.04 LTS)
I am trying to load a .csv file lying on my desktop using pandas on jupyter notebook and getting the following error:
What's the problem with the code? The same method works on windows. (I'm using ubuntu 16.04 LTS)
Try passing encoding='utf-8'
argument in your read_csv
function, like this:
data = pd.read_csv('file_name.csv', encoding='utf-8')
filepath = r"/home/aditisp/Documents/Untitled Folder/sonar_data.csv"
##the preceding r denotes a string literal
df = pd.read_csv(filepath)
print(df.head())
This worked for me.