I have my CSV files in a Data Folder in Jupyter Notebook, then I have a few other notebooks that I want to rely on the CSV files in the Data Folder. How do I read in the CSV files From the Data Folder into the notebooks that I want the analysis to occur in? I'm using a Mac and doing this in Python.
1 Answer
You need to specify the path to the csv file you want to put in pd.read_csv. For example, if your jupyter notebook is located on your Desktop, and the csv file (lets call it "my_project_1") is somewhere else, say in a folder called Projects, and that folder is in your Documents folder, then you specify the path as following:
import pandas as pd
df = pd.read_csv('/Users/your_user_name/Documents/Projects/my_project_1.csv')
Don't forget to change your_user_name to your actual user name.
1 Comment
Abhinav Saxena
is it for Linux only? Will it work with windows?