【发布时间】:2021-01-30 22:55:54
【问题描述】:
从here 的数据中汲取灵感,我们有以下系列/数据框
df = data.groupby(["Manufacturer","Product Name","Product Launch Data"]).sum("total")
total
Manufacturer Product Name Product Launch Date
Apple iPad 2010-04-03 30
iPod 2001-10-23 34
Samsung Galaxy 2009-04-27 24
Galaxy Tab 2010-09-02 22
我们如何在total 之后排序,同时仍然保留组,即以:
total
Manufacturer Product Name Product Launch Date
Apple iPad 2010-04-03 30
iPod 2001-10-23 34
Samsung Galaxy Tab 2010-09-02 22
Galaxy 2009-04-27 24
【问题讨论】:
标签: python pandas multi-index