sort values pandas ascending one descending other code example
Example 1: python dataframe sort by column name
>>> result = df.sort(['A', 'B'], ascending=[1, 0])
Example 2: sort columns dataframe
df = df.reindex(sorted(df.columns), axis=1)
>>> result = df.sort(['A', 'B'], ascending=[1, 0])
df = df.reindex(sorted(df.columns), axis=1)