One quick question. The "pivot_table" auto arrange mymonth column into alphabetical order. How do I make it stopauto rearrange the order? My month order support to go indescending order from Dec to Jan.
Thank you in advance
df = df.pivot_table(index='Month', df.head (12) columns='Year', values='Temperature') Year 1995 1996 1997 1998 1999 Month 2000 2001 2002 2003 Dec Feb 50.1 33.2 40.8 31.6 Apr 56.2 39.1 51.0 50.0 57.5 44.6 53.9 53.1 46.1 54.7 Aug 80.0 63.7 66.2 60.6 75.7 66.6 69.0 62.2 63.5 70.4 46.9 46.2 38.8 39.9 51.0 53.3 50.9 51.2 48.7 45.7 49.4 34.7 52.5 38.2 51.4 46.3 49.1 29.7 49.2 42.7 68.1 58.3 61.7 60.1 61.1 64.1 58.2 38.3 47.4 35.6 Jan 34.2 39.5 27.0 43.2 48.0 Jul 62.7 57.9 57.8 61.1 62.6 Jun 62.8 56.7 56.9 60.0 59.5 62.1 57.5 53.3 58.4 35.4 Mar 45.9 42.6 48.0 43.3 May 56.0 51.0 60.4 48.0 58.1 53.7 Nov 48.5 56.1 41.0 45.0 67.2 57.5 48.4 57.6 47.5 50.7 53.7 51.8 47.2 56.4 47.7 51.3 61.7 58.2 55.8 Oct 60.5 53.7 58.1 64.6 68.0 66.4 58.9 60.5 59.4 60.1 60.4 Sep 63.2 61.0 12 rows x 25 columns 42.2 55.4 2004 60.4 40.5 2010 2011 2012 2013 2014 2015 2016 2017 42.1 56.0 45.8 37.0 54.7 45.3 45.9 52.8 42.2 47.0 65.9 70.6 63.9 78.0 66.9 61.3 59.6 62.7 66.9 68.1 31.8 49.7 34.9 42.5 55.4 35.0 39.8 50.4 38.4 54.1 50.4 41.5 34.7 47.7 41.1 43.2 44.0 47.3 82.3 60.6 65.0 74.2 64.6 66.1 65.5 66.6 34.7 38.2 33.4 43.1 46.7 33.4 42.0 51.8 43.0 48.3 68.3 60.5 58.7 62.3 63.6 55.3 58.0 62.7 56.9 62.8 52.9 55.1 40.4 39.3 47.4 40.5 41.0 47.6 47.8 53.8 58.6 57.4 49.4 52.7 48.0 49.5 50.9 54.7 45.3 54.9 59.3 47.7 48.3 57.9 67.8 57.7 58.4 63.0 56.7 52.7 45.0 27.3 49.1 53.3 51.3 48.0 55.6 61.1 51.8 60.2 59.8 62.3 60.3 60.3 59.4 64.1 61.0 64.1 60.6 59.5 2018 2019 45.4 50.5 46.9 39.1
One quick question. The "pivot_table" auto arrange my month column into alphabetical order. How do I make it stop auto r
-
- Site Admin
- Posts: 899603
- Joined: Mon Aug 02, 2021 8:13 am