Answers for "compare dataframe difference on column"

3

comparing two dataframe columns

comparison_column = np.where(df["col1"] == df["col2"], True, False)
Posted by: Guest on November-04-2020
0

find difference between two pandas dataframes

# by doing outer, you will get records from both the sides.
f = df1.merge(df2,indicator = True, how='outer').loc[lambda x : x['_merge']!='both']
Out[421]: 
   A  B     _merge
1  2  3  left_only
2  3  4  left_only
3  3  4  left_only

left_unique_result = f.loc[lambda x: x['_merge'] == 'left_only']
right_unique_result = f.loc[lambda x: x['_merge'] == 'right_only']
Posted by: Guest on June-15-2021

Code answers related to "compare dataframe difference on column"

Python Answers by Framework

Browse Popular Code Answers by Language