today I struggle to make Jupyter read a csv file I have downloaded. When it was saved like this "C:\Users\argir\state.csv"
Jupyter
was able to read it. (photo: https://ibb.co/qYLmWb0
). But when I put it in a folder and the path was "C:\Users\argir\datasets_dika_mou\state.csv
" (photo: 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 ) the Jupyter couldn't read it
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")
CodePudding user response:
From the code you put into the comment, it could be that you simply not defining the path to the file.
When your file is at the same directory as the Notebook your code will work, but when the file is not at the same path you have to tell python where to look.
like:
import pandas as pd
state_data = pd.read_csv("datasets_dika_mou/state.csv")