Last answered:

26 Oct 2021

Posted on:

26 Oct 2021

0

Resolved: FileNotFoundError what locating the CSV

I am having trouble getting this to read the file provided.
I am typing

df_used_cars = pd.read_csv("C:/Users/user/Downloads/bar_chart_data.csv")

But I keep getting an error.

FileNotFoundError: [Errno 2] No such file or directory: 'C:/Users/user/Downloads/bar_chart_data.csv'

Does anyone have any ideas as to why this is happening?

2 answers ( 1 marked as helpful)
Instructor
Posted on:

26 Oct 2021

1

Hi Connor,
thanks for reaching out! So the error you're getting means that either the file path or the files name are incorrect. To troubleshoot you can do the following:
1. Make sure you download the csv file from this lecture:
https://learn.365datascience.com/courses/data-visualization/bar-chart-introduction-general-theory-and-dataset/
2. It could be in a .zip file, if so you should unzip it.
3. A) Make sure that your Jupyter notebook is in the same directory as the downloaded bar_chart_data.csv. Then you can read it into a pandas data frame with the following command:

df_used_cars = pd.read_csv("bar_chart_data.csv")

3 B) Alternatively, you can add the file path to the directory where you've downloaded the file. Make sure you use the forward slashes when adding the path, like so:

df_used_cars = pd.read_csv("C:/Provideyourownpath/bar_chart_data.csv")

Hope this helps!

Best,
365 Eli

Posted on:

26 Oct 2021

0

Thank you so much <3 it worked! I had the wrong file format. I was using the .xlsx from the previous lesson.

Submit an answer