Im trying to create a pivot table out of the seaborn flights dataset. When I come to make a pivot table for a heat map the index column is ordered alphabetically when I want to order it chronologically from Jan to Dec. Does anyone know how to do this? I have deleted the values in the pivot table to make it look tidier when I copied and pasted from Jupyter notebooks.
import pandas as pd
import seaborn as sns
#Loading dataset
flights = sns.load_dataset('flights')
#Calling dataset
flights
year month passengers
0 1949 January 112
1 1949 February 118
2 1949 March 132
3 1949 April 129
4 1949 May 121
... ... ... ...
139 1960 August 606
140 1960 September 508
141 1960 October 461
142 1960 November 390
143 1960 December 432
flights.pivot_table(values='passengers',index='month',columns='year')
year 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960
month
April Values.....
August
December
February
January
July
June
March
May
November
October
September