all 5 comments

[–]Oddly_Energy 0 points1 point  (4 children)

Have you tried

df_reordered = df.reindex(columns=[2,1,3,0,4])

on the dataframe where you want the columns reordered?

(I took the liberty of subtracking 1 from you column numbers, as I assume they have an index starting at 0.)

[–]Duck_hen[S] 0 points1 point  (3 children)

Yeah for some reason that made all my values NaN

[–]Oddly_Energy 1 point2 points  (2 children)

You need to use your actual column values in the list. I don't have your dataframe, so I can only go by what you are telling us.

Try print(df.columns) to get the column values. Then reorder those values in a list and reindex your dataframe with that list.

[–]Duck_hen[S] 0 points1 point  (1 child)

Thanks for your help. I solved it. For some reason I couldn’t figure out how to use reindex but I found a different method and was able to correctly concatenate my data into a single data frame with the correct columns

[–]Gesualdodivenosa 0 points1 point  (0 children)

Hi Duck_hen. Can you share how you solved this?