Given the following pivot table: import pandas as pd import numpy as np df = pd.DataFrame( {'YYYYMM':[201603,201503,201403,201303,201603,201503,201403,201303], 'Co
Solution 1:
Use sort_values
t.sort_values(('Count', 2016))
the tuple ('Count', 2016) is the name of the column you want to sort by.
looks like:
CountYYYYMM2013 2014 2015 2016GroupB9874A7265
Share
Post a Comment
for "Pandas Sort Multiindex Pivot Table"
Post a Comment for "Pandas Sort Multiindex Pivot Table"