dataframe sort list column code example
Example 1: pandas sort columns by name
df = df.reindex(sorted(df.columns), axis=1)
Example 2: dataframe, sort by columns
final_df = df.sort_values(by=['2'], ascending=False)
df = df.reindex(sorted(df.columns), axis=1)
final_df = df.sort_values(by=['2'], ascending=False)