Creating a separate Counter() object and Pandas DataFrame for each list within a list of lists
问题 All the other answers I could find specifically referred to aggregating across all of the nested lists within a list of lists, where as I'm looking to aggregate separately for each list. I currently have a list of lists: master_list = [[a,a,b,b,b,c,c,c], [d,d,d,a,a,a,c,c,c], [c,c,c,a,a,f,f,f]] I want to return a dictionary or Counter() objects for each list with a loop: counter1 = {'a': 2, 'b': 3, 'c': 3} counter2 = {'d': 3, 'a': 3, 'c': 3} counter3 = {'c': 3, 'a': 2, 'f': 3} Currently, I'm