Stanislav Jirák
Stanislav Jirák

Reputation: 485

How to correctly input a path for a .csv file on Mac OS Jupyter Notebook

I have a .csv file I want to load into pandas dataframe within the same folder as my project notebook. I'm using Mac OS a Jupyter Notebook. The file folder is:

/Documents/Notebooks/BM_Case/DrinkItems.csv

I've tried totally every possible path incl.:

drinks = pd.read_csv('/Users/Documents/Notebooks/BM_Case/DrinkItems.csv')

or

drinks = pd.read_csv('DrinkItems.csv')

but it always raises

FileNotFoundError: [Errno 2] File /Users/Documents/Notebooks/BM_Case/DrinkItems.csv does not exist: '/Users/Documents/Notebooks/BM_Case/DrinkItems.csv'

The .csv file is physically in the folder. What am I doing wrong?

Upvotes: 0

Views: 2496

Answers (1)

Tomasz Swider
Tomasz Swider

Reputation: 2372

It looks like you have missed your user id from the full path

you can test the path in the cli

 ls -lh /Users/Documents/Notebooks/BM_Case/DrinkItems.csv

 ls -lh /Users/<your user home>/Documents/Notebooks/BM_Case/DrinkItems.csv

Upvotes: 1

Related Questions