Want to merge two dataframe column wise

Viewed 33

I have two dataframes df and df1 and I want to merge them in such way that I get result as showcased below. I have tried using pd.concat but it didn't work out. While using pd.merge I get error:

ValueError: You are trying to merge on object and float64 columns. If you wish to proceed you should use pd.concat
    df

df1

df2

df2

Expected Output:enter image description here

1 Answers

It's most likely because the columns that you want to merge are not the same dtype. In pd.merge specify which columns who want to join on, and check using df.dtypes and df2.dtypes to see if the columns you want to join are the same dtypes.

Related