Appending columns to the right of dataframe

Viewed 1350

It's a rather simple question but i can't seem to work it out. I have the below code which appends two dataframes together:

final_dataframe = pd.concat([final_dataframe, df]) #append to final table

The only issue i have is it appends to the bottom, is there anyway to make it append to the right?

1 Answers

Here you didn't use axis, pass param axis=1 to concatenate the list of dfs column-wise.

Use:

 pd.concat([final_dataframe, df], axis=1)
Related