本文介绍了在Jupyter Notebook中使用 pandas 导入CSV文件时出现FileNotFoundError的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

描述的错误的屏幕截图.

import pandas as pd
df = pd.read_csv('/home/josepm/Documents/test_ver2.csv')

---------------------------------------------------------------------------
FileNotFoundError                         Traceback (most recent call last)
<ipython-input-3-5cd7fd573fb7> in <module>()
      1 import pandas as pd
----> 2 df = pd.read_csv('/home/josepm/Documents/test_ver2.csv')

我尝试使用pandas导入CSV文件,并且每次它说找不到文件时都尝试导入.就像Jupyter没看到它.我尝试这样做:

I try to import a CSV file using pandas and every time it says that it doesn't find the file. It's like Jupyter doesn't see it. I tried to do this:

import os
os.path.isfile('/home/josepm/Documents/test_ver2.csv')

它也看不到文件.

推荐答案

更改

pd.read_csv('\Users\user\Desktop\Workbook1.csv')

pd.read_csv(r'C:\Users\user\Desktop\Workbook1.csv')

这篇关于在Jupyter Notebook中使用 pandas 导入CSV文件时出现FileNotFoundError的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-18 21:09