读取python中的csv文件

时间:2019-07-23 08:16:34

标签: python pandas

当我尝试在python中读取csv文件时,出现以下错误。

df= pd.read_csv('C:\Users\harshvardhans\Desktop\PYTHON\Berkely.csv')
                   ^

  File "<ipython-input-4-09a047945cf2>", line 1
    df= pd.read_csv('C:\Users\harshvardhans\Desktop\PYTHON\Berkely.csv')
                   ^
SyntaxError: (unicode error) 'unicodeescape' codec can't decode bytes in position 2-3: truncated \UXXXXXXXX escape

1 个答案:

答案 0 :(得分:-1)

反斜杠是转义字符。将文件路径中的内容加倍。