I have a lot of different files that I'm trying to load to pandas in a pythonic way but also to add to different cells to make this look easy. Now I have 36 different variables but to make things easy, I'll show you an example with three different dataframes.
But let's say I'm uploading CSV files with this into dataframes but in different cells, automatically generated.
file_list = ['df1.csv', 'df2.csv', 'df3.csv']
name_list = ['df1', 'df2', 'df3']
I could easy create three different cells and type:
df1 = pd.read_csv('df1.csv')
But there are dozens of different CSVs and I want to do similar things like delete columns and there have to be easier ways.
I've done something such as:
var_list = []
for file, name in zip(file_list, name_list):
var_name = name
var_file = pd.read_csv(file)
var_list.append((file, name, var_file))
print(var_list)
But this all occurs in the same cell.
Now I looked at the ipython docs, as this is the package I believe has to do with this, but I couldn't find anything. I appreciate your help.