简体   繁体   English

无法在 Python 熊猫库中运行 csv 文件

[英]Not able to run csv file in Python Panda Library

pd.read_csv("C:\Users\thesa\OneDrive\Desktop\Data Sets\datasets-session-16\subs.csv")

error错误

I was trying to read a csv file in jupyter notebook using pandas, but it is not working.我试图使用 pandas 在 jupyter notebook 中读取 csv 文件,但它不起作用。

Your problem is with the string你的问题是字符串

Here, \U in "C:\Users... starts an eight-character Unicode escape, such as \U00014321.这里,"C:\Users...中的\U开始了一个8字符的Unicode转义,比如\U00014321。

you can double the backslashes Or prefix the string with r您可以将反斜杠加倍或在字符串前加上 r

pd.read_csv("C:\\Users\\thesa\\OneDrive\\Desktop\\Data Sets\\datasets-session-16\\subs.csv")

pd.read_csv(r"C:\Users\thesa\OneDrive\Desktop\Data Sets\datasets-session-16\subs.csv")

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM