为什么 Jupyter 在文件夹中无法读取 csv 文件?
Why Jupyter can't read csv files when they are in folders?
今天我努力让 Jupyter 读取我下载的 csv 文件。当它像这样保存时 "C:\Users\argir\state.csv"
Jupyter
能够阅读它。 (photo: https://ibb.co/qYLmWb0
)。但是当我把它放在一个文件夹中并且路径是“C:\Users\argir\datasets_dika_mou\state.csv
”(照片:https://ibb.co/mBVQS3f ) or when it was saved in another folder on the desktop and the path was C:\Users\argir\Υπολογιστής\datasets
from 50 practical-statistics-for-data-scientistsebook oreilly\state.csv
" (photo: https://ibb.co/M7m3PTF)时,Jupyter 无法读取它
FileNotFoundError: [Errno 2] No such file or directory: 'state.csv'
Why does this happen?
import pandas as pd
state_data = pd.read_csv("state.csv")
从您在评论中输入的代码来看,您可能只是没有定义文件的路径。
当您的文件与笔记本位于同一目录时,您的代码将正常工作,但当文件不在同一路径时,您必须告诉 python 查找位置。
喜欢:
import pandas as pd
state_data = pd.read_csv("datasets_dika_mou/state.csv")
今天我努力让 Jupyter 读取我下载的 csv 文件。当它像这样保存时 "C:\Users\argir\state.csv"
Jupyter
能够阅读它。 (photo: https://ibb.co/qYLmWb0
)。但是当我把它放在一个文件夹中并且路径是“C:\Users\argir\datasets_dika_mou\state.csv
”(照片:https://ibb.co/mBVQS3f ) or when it was saved in another folder on the desktop and the path was C:\Users\argir\Υπολογιστής\datasets
from 50 practical-statistics-for-data-scientistsebook oreilly\state.csv
" (photo: https://ibb.co/M7m3PTF)时,Jupyter 无法读取它
FileNotFoundError: [Errno 2] No such file or directory: 'state.csv' Why does this happen?
import pandas as pd
state_data = pd.read_csv("state.csv")
从您在评论中输入的代码来看,您可能只是没有定义文件的路径。
当您的文件与笔记本位于同一目录时,您的代码将正常工作,但当文件不在同一路径时,您必须告诉 python 查找位置。
喜欢:
import pandas as pd
state_data = pd.read_csv("datasets_dika_mou/state.csv")