0

I'm trying to read a csv file on python. The code goes like this -

import pandas as pd
df = pd.read_csv("C:\Users\User\Desktop\Inan")
print(df.head())

However it keeps showing the unicode error. Tried putting r,changing the slashes in multiple ways,but it didnt't work,just showed different errors like "file not found". What can I do?

not_speshal
  • 22,093
  • 2
  • 15
  • 30
Ahnaf
  • 1
  • 4
  • 2
    Please post the full error. Also, did you try the accepted answer [here](https://stackoverflow.com/questions/18171739/unicodedecodeerror-when-reading-csv-file-in-pandas-with-python) ? – not_speshal Jul 07 '21 at 17:43

1 Answers1

0

Try this method, It may work

df = pd.read_csv("C:/Users/User/Desktop/Inan.csv",  encoding="utf-8")

include your file extension also(.csv .xlxs)

Naga vamsi
  • 12
  • 4