df = pd.DataFrame({
…: ‘sp’ : [‘MM1’, ‘MM1’, ‘MM1’, ‘MM2’, ‘MM2’, ‘MM2’, ‘MM4’, ‘MM4’,‘MM4’],
…: ‘mt’ : [‘S1’, ‘S1’, ‘S3’, ‘S3’, ‘S4’, ‘S4’, ‘S2’, ‘S2’, ‘S2’],
…: ‘val’ : [‘a’, ‘n’, ‘cb’, ‘mk’, ‘bg’, ‘dgb’, ‘rd’, ‘cb’, ‘uyi’],
…: ‘count’ : [3,2,5,8,10,1,2,2,7]
…: })
nlargest
添加链接描述
groupby.SeriesGroupBy.nlargest
添加链接描述