I have pivot table:
avg count
days 10d 1d 20d 3d 5d 10d 1d 20d 3d 5d
range
0.1 5.9 % 1.25 % 8.27 % 3.28 % 4.42 % 1104.0 1104.0 1104.0 1104.0 1104.0
0.2 4.74 % 0.96 % 7.27 % 2.22 % 3.14 % 2274.0 2274.0 2274.0 2274.0 2274.0
0.3 4.04 % 0.73 % 6.63 % 1.82 % 2.72 % 3293.0 3293.0 3293.0 3293.0 3293.0
And would like to change the order of columns "days" to original:
['1d', '3d', '5d', '10d', '20d']
I tried:
days=['1d', '3d', '5d', '10d', '20d']
table1=table.pivot(index='range',columns='days').reindex(columns=days)
but this leads to error "TypeError: Expected tuple, got str".
How can i change or create pivot table that will have columns in non alphabetical order ['1d', '3d', '5d', '10d', '20d']?
Thank you for any tips.