I am curious about the need to list the path in the loop for this lesson. If you have all of your csv files in the same folder as your workbook in jupyter, why would you need to state the path? We have never had to do this before.
If there is a reason for this, it should be stated explicitly in the lesson. This does not seem to involve a logic that we are unfamiliar with, but rather a simple fact that is hidden from students.
Screen Link: Learn data science with Python and R projects
My Code:
import pandas as pd
data_files = [
"ap_2010.csv",
"class_size.csv",
"demographics.csv",
"graduation.csv",
"hs_directory.csv",
"sat_results.csv"
]
data = {}
for f in data_files:
d = pd.read_csv('schools/{}'.format(f))
key_name = f.replace(".csv", "")
data[key_name] = d