Taking a list of data frames and grouping by a variable and using that variable as the key to a dictionary
问题 I am relatively new to python programming. I have a list of pandas dataframes that all have the column 'Year'. I am trying to group by that column and convert to a dictionary where the dictionary key is the variable 'Year' and values is a list of dataframes of that year. Is this possible in python? I tried this: grouped_dict = list_of_csv_files.groupby(by = 'Year').to_dict() I believe I will have to loop through each dataframe? I did not provide any data because I am hoping it is a somewhat