📜  nlargest hierarchy series pandas - Python 代码示例

📅  最后修改于: 2022-03-11 14:45:07.720000             🧑  作者: Mango

代码示例1
print (grouped.groupby(level='yearmonth').nlargest(3).reset_index(level=0, drop=True))
yearmonth  product
201601     E          180
           A          100
           B           90
201602     F          220
           A          200
           C          120
201603     B          120
           C          110
           D          110
Name: val, dtype: int64