Use a categorical column and set the order of the categories the way you want them.

df4['fiscal_year'] = pd.Categorical(df4['fiscal_year'], categories=[2019, 2018, 2017, 2016, 2015], ordered=True)

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top