pandas pivot选项卡中的重新排序列

2024-05-15 22:04:54 发布

您现在位置:Python中文网/ 问答频道 /正文

如何重新排序此数据框中的土地利用列:

Region                       North         South
LandUse          Year                           
Corn             2005  149102.3744  2078875.0976
                 2010  201977.2160  2303998.5024
Developed        2005    1248.4416    10225.5552
                 2010     707.4816     7619.8528
Forests/Wetlands 2005   26511.4304    69629.8624
                 2010   23433.7600    48124.4288
Open Lands       2005  232290.1056   271714.9568
                 2010   45845.8112   131696.3200
Other Ag         2005  125527.1808   638010.4192
                 2010  257439.8848   635332.9024
Soybeans         2005   50799.1232  1791342.1568
                 2010   66271.2064  1811186.4512

目前,“土地利用”是按字母顺序组织的。我希望它按以下顺序排列:

^{pr2}$

Tags: 数据排序openyearregionothersouthag