Python Forum

Full Version: Pandas DataFrame and unmatched column
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
df1 has 3 columns 'A','B','C' df2 has 3 columns 'A','B','C'

below is the option tried for find common records between two columns('A','B') in two dataframes and finding the unmatched records on column('C').

Please suggest , if there is a better way.

matched_on_AB_not_C = pd.merge(df1,df2,on=['A','B'], how='inner')
duration_diff = (matched_on_AB_not_C['C_y'].ne(matched_on_AB_not_C['C_x']))