I am using this code to merge two dataframe :
pd.concat(df1, df2, on='a', how='outer')
I am getting the following error:-
TypeError: concat() got an unexpected keyword argument 'on'
I am using this code to merge two dataframe :
pd.concat(df1, df2, on='a', how='outer')
I am getting the following error:-
TypeError: concat() got an unexpected keyword argument 'on'
I believe you want merge
:
df = pd.merge(df1, df2, on='a', how='outer')
But also concat
is possible - it return default outer join by index of both DataFrames
, so added []
and DataFrame.set_index
:
df = pd.concat([df1.set_index('a'), df2.set_index('a')], axis=1)
You should try the merge
method.
pd.merge(df1, df2, how='outer', on='a')
https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.concat.html#pandas.concat
Here's the documentation for concat. As you can see, there is no 'on' (or how) arg, so you just need to adjust your parameters accordingly.