I uninstalled and reinstalled Anaconda yesterday and went to begin a project this afternoon. When importing my data I did the below, as per ususal:
import pandas as pd
covid = pd.read_csv("covidbb")
I was met with an error stating : FileNotFoundError: [Errno 2] No such file or directory: 'covidbb'
I really am not sure how to go about this, I watched a few YT vids to set a WD and other threads but just do not understand what is happening. Any help is appreciated.
CodePudding user response:
Create the covidbb
file, it is not found, you might have it not in the same directory as the script
CodePudding user response:
Copy this test script in the same directory as your current script.
test.py
:
import pandas as pd
import pathlib
df = pd.read_csv(pathlib.Path(__file__) / 'covidbb')
print(df)
CodePudding user response:
You just need right click your .py file and press set console as working directory with caring your .py and csv in the same directory. If it is not helpful you can change your script as:
covid = pd.read_csv("covidbb",'r')