1

I have a list of 200 pandas dataframes.

I know I can do:

df1, df2, df3, ..., df200 = [list of 200 dataframes]

Is there a way to elegantly assign distinct variable names to each dataframe?

user7288808
  • 117
  • 2
  • 8
  • 3
    Don't do that, store them in a dict. You do not want to have 200 variables floating around outside of a container: `d = dict((f'df{i+1}', l[i]) for i in range(len(l)))` where `l` is your list. Now you acces them by `d['df1']` – ALollz May 09 '19 at 21:31
  • @ALollz Thanks. How would you save the into dictionary? I've never done that. – user7288808 May 09 '19 at 21:32
  • @ALollz, thank you very much for your suggestion. – user7288808 May 10 '19 at 13:57

0 Answers0