I have three dataframes. Their shapes are (2656, 246), (2656, 2412) and (2656, 7025). I want to merge dataframes as above:
So It will result a (2656, 9683) Dataframe. Thanks for any help.
Typo on image: on Dataframe 3, it will 7025, not 5668.
Data Science Stack Exchange is a question and answer site for Data science professionals, Machine Learning specialists, and those interested in learning more about the field. It only takes a minute to sign up.Sign up to join this community
Assuming that the rows are in same order that you wish to merge all of the dataframes, you can use the concat command specificying axis=1.
new_df = pd.concat([df1, df2, df3], axis=1)
If the row index for each of the data frames are different and you want to merge them in the current order, you can also apply ignore_index:
new_df = pd.concat([df1, df2, df3], ignore_index=True)
For details on the merge, join & concatenation operations, please refer to the pandas docs.