I am attempting to name multiple dataframes using a variable in a for loop. Here is what I tried:
for name in DF['names'].unique(): df_name = name + '_df' df_name = DF.loc[DF['names'] == str(name) If one of the names in the DF['names'] column is 'George', the below command should work to print out the beginning of of of the dataframes that was generated.
George_df.head() But I get an error message:
TypeError: unsupported operand type(s) for +: 'int' and 'str' Previous questions discuss ways to do this in a dictionary, but I am looking for a way to implement this for a dataframe.
ctrl-k)