Answers for "take union of two dataframes pandas"

2

union df pandas

pd.concat([df1, df2])
Posted by: Guest on April-13-2020
0

take union of two dataframes pandas

m = {'left_only': 'df1', 'right_only': 'df2', 'both': 'df1, df2'}

result = df1.merge(df2, on=['A'], how='outer', indicator='B')
result['B'] = result['B'].map(m)

result
Posted by: Guest on May-19-2020

Code answers related to "take union of two dataframes pandas"

Python Answers by Framework

Browse Popular Code Answers by Language