吃鸡游戏
看看这是否有帮助:import pandas as pddf = pd.DataFrame({'Model Id': ['102', '102', '1094', '2017p','225','225','250U','3000'], 'churn flag': ['N','Y','Y','N','N','Y','N','N'], 'count':[10,2,1,12,37,1,60,6]})dict(iter(df.groupby('churn flag')))这会给你{'N': Model Id churn flag count 0 102 N 10 3 2017p N 12 4 225 N 37 6 250U N 60 7 3000 N 6, 'Y': Model Id churn flag count 1 102 Y 2 2 1094 Y 1 5 225 Y 1}这是你要找的吗?