【问题标题】:Can't read csv file on Jupyter notebook无法在 Jupyter 笔记本上读取 csv 文件
【发布时间】:2021-11-18 17:05:34
【问题描述】:

我无法在 Jupyter Notebook 上打开 CSV 文件。每次我尝试打开时,我都会得到这个......

任何建议或意见将不胜感激!

【问题讨论】:

  • 您在哪里运行 Jupyter 笔记本?错误消息显示 Python 正在 Linux 中运行,但您提供的是 Windows 路径。

标签: python pandas jupyter-notebook


【解决方案1】:

试试

df = pd.read_csv(r'Path where the CSV file is stored\File name.csv')

【讨论】:

  • 您能否添加有关建议代码如何解决问题的详细信息?纯代码答案对提问者和其他人都不是很有帮助。
【解决方案2】:

问题在于路径中的正斜杠。将它们更改为双反斜杠:

C:/Users/nsap/desktop...

C:\\Users\\nsap\\desktop

请查看此 stackoverflow 链接了解更多信息Error while reading a csv file in python using pandas

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2021-09-29
    • 2020-04-02
    • 1970-01-01
    • 1970-01-01
    • 2018-10-13
    • 2021-10-09
    • 2020-09-22
    相关资源
    最近更新 更多