python sort out columns code example Example: sort columns dataframe df = df.reindex(sorted(df.columns), axis=1)