I recently brought my code from Jupyter into VSCode. I fixed up some problems with my imports, but now I can't find a .csv file. The code and .csv file are saved in the same folder. My code is:
import pandas
df = pandas.read_csv('emailss.csv', names=['Email', 'Amiability'])
After running the program, it says,
FileNotFoundError: [Errno 2] No such file or directory: 'emailss.csv'
What's going on here? How can I fix it? It was working perfectly in Jupyter.
Here is a screenshot:
CodePudding user response:
where are you running the code from? Is the CSV file in the same directory as your python file, if yes is the console path the same as the python script and the CSV file?
CodePudding user response:
Check with os.getcwd()
that your current working directory matches with the file path
CodePudding user response:
if possible share your folder screen as a picture, so that we can find the error,
In common, everything you did correct but file not found means 1-check name twice, 2-save your 'csv' file again in program file path. (for confirmation, sometimes file may be saved in some other formats)