So ändern Sie die Spaltenreihenfolge in Pandas DataFrame
df = df.reindex(columns=column_names)
Ugliest Unicorn
df = df.reindex(columns=column_names)
# User .transpose()
# Scenario 1
df = pd.DataFrame(data).transpose()
# Scenario 2
df = pd.DataFrame(evaluation[fold])
df.transpose()
df = df.reorder_levels(column_names, axis)
# axis => {0 or ‘index’, 1 or ‘columns’}, default 0
# column_names => List representing new level order. Reference level by number (position) or by key (label).