0

I have a dictionary like this: dict_eg = {'long name1':'short name1', 'long name2':'short name2', ...}

And I have a dataframe that I would like to filter based on the long name, and name that dataframe based on the short name. This would then loop through each long name option creating separate dataframe.

I have got the filter part working, but how I can name the dataframes created off of each distinct long name.

for long, short in dict_eg.items():
    **help_me_here_plz** = df_all[df_all['Column'] == column]
  • the new dataframe names should be a concatenation of 'df_' and the short name from the dictionary. – Luke Boston Dec 14 '17 at 01:52
  • First off, you have a cool last name! I think this [SO Post](https://stackoverflow.com/a/5036775/6361531) is good. I thought about this when I read your question. Use a dictionary instead of creating new variables. – Scott Boston Dec 14 '17 at 13:39

0 Answers0