1

I am trying to read into a pandas dataframe from a csv. The data is in the format:

date,total_bytes
2018-08-27,1.84E+14
2018-08-30,1.90E+14
2018-08-31,1.93E+14

My code looks like:

from pandas import read_csv
from pandas import datetime
from matplotlib import pyplot


series = 
read_csv(r'/Users/taylorjewell/Desktop/dataset_size_daily.csv', 
header=0)
print(series.head())
series.plot()
pyplot.show()

Despite that path existing (I have checked countless times), I am getting a file not found exception for some reason:FileNotFoundError: File b'/Users/taylorjewell/Desktop/dataset_size_daily' does not exist

I am running this on a mac if that is relevant. Any help you are able to offer would be much appreciated!!

2
  • 1
    why did you read file dataset_size_daily.csv but the error says dataset_size_daily only (without csv)? Commented Aug 12, 2019 at 21:14
  • 1
    In the interpreter, what do you get when your type in r'/Users/taylorjewell/Desktop/dataset_size_daily.csv' ? Commented Aug 12, 2019 at 21:18

3 Answers 3

1

For file paths, I would suggest using pathlib:

from pathlib import Path

data_file = Path("/Users/taylorjewell/Desktop/dataset_size_daily.csv")

series = read_csv(data_file, header=0)

However, it also depends on where you are trying to access the file from.

Sign up to request clarification or add additional context in comments.

Comments

0

i dont think you need to use the r bit for mac try read_csv('/Users/taylorjewell/Desktop/dataset_size_daily.csv', header=0)

Comments

0

Just ran into this issue today and wanted to share-

If you download a CSV file to a mac But then open the file and save it The file extension changes to .numbers

So make sure you just move the file without opening it, and double-check that the file extension is .csv

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.