I have a list files that I want to iterate over and import as dataframes:
data_files = ['data1.csv', 'data2.csv', 'data3.csv']
I'm trying to iterate over the list and create eponymously name dataframes, kind of like doing the following manually:
data1 = pd.read_csv('data1.csv')
data2 = pd.read_csv('data2.csv')
data3 = pd.read_csv('data3.csv')
I tried this:
for i in data_files:
name = i.split('.')
name = pd.read_csv(name + ".csv")
The problem with the above is that it's just creating "i" as a dataframe, and not creating a set of eponymous dataframe objects. Can someone help me with this?