python - 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
解决方案
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'
另一种解决方案是使用!
shell命令,改变目录,你可以写类似的命令!cd
,!ls
将目录改变为当前文件。
推荐阅读
- azure - 创建 azure 资源时 -Confirm 的可接受参数
- android - 登录屏幕上的 EditText 验证
- php - Laravel如何生成六个不同整数的随机用户ID
- r - R:调试 Plotly 代码 - 找不到对象(时间序列分析)
- c - QMK RGB 饱和度触底
- amazon-web-services - 如果我已经拥有我的私有证书,我是否需要 AWS 的证书颁发机构?
- terraform - 如何在 terraform 中正确使用 for_each 中的 each.value?
- python-3.x - 如何使用 tensorflow 2 模型动物园在自定义对象检测器中创建检查点?
- javascript - 将组件的结果传递给渲染返回未定义?
- flexbox - 嵌套在部分类中的 DIV 类未设置为显示:flex