0

I have following train dataframe kind of dataframe, train_df

A   B   C   D
6   8   7   3
7   9   1   8
11  7   2   3

and my test dataframe columns arrangement is as following, test_df

C   A   D   B
4   2   3   9
7   4   7   3
5   1   2   4

I want my test_df as following

A   B   C   D
2   9   4   3
4   3   7   7
1   4   5   2

I have 300 such mixed columns in my test_df how to match sequence of test_df with that of train_df?

Nikhil Mangire
  • 397
  • 5
  • 13

1 Answers1

0
test_df.reindex_axis(train_df.columns, axis=1)
Nikhil Mangire
  • 397
  • 5
  • 13