首页 > 解决方案 > Anaconda 中的 FILE NOT FOUND 错误

问题描述

这段代码给了我一个file not found错误,我不知道是不是文件位置给我带来了麻烦。我是 Python 新手。

import pandas as pd 
df= pd.read_csv('breast-cancer-wisconsin.data.txt')

#file location = 'C:\Users\qeee11\Downloads\breast-cancer-wisconsin.data.txt'

df

标签: pythonjupyter-notebook

解决方案


import pandas as pd 
df= pd. read_csv('breast-cancer-wisconsin.data.txt') 
# Give commands to extract the directory like getcwd()
#like , data_path = os.path.join(os.getcwd(), 'data')

file location = 'C:\Users\qeee11\Downloads\breast-cancer-wisconsin.data.txt'

getcwd() 详细信息

另一种解决方案是使用!shell命令,改变目录,你可以写类似的命令!cd!ls将目录改变为当前文件。


推荐阅读