How to summarize on different groupby combinations?
问题 I am compiling a table of top-3 crops by county. Some counties have the same crop varieties in the same order. Other counties have the same crop varieties in a different order. df1 = pd.DataFrame( { "County" : ["Harney", "Baker", "Wheeler", "Hood River", "Wasco" , "Morrow","Union","Lake"] , "Crop1" : ["grain", "melons", "melons", "apples", "pears", "raddish","pears","pears"], "Crop2" : ["melons","grain","grain","melons","carrots","pears","carrots","carrots"], "Crop3": ["apples","apples",