pd.merge(A, B, on='col', how='left', indicator=True).query(
    "_merge == 'left_only'")
pd.merge(A, B, on='col', how='right', indicator=True).query(
    "_merge == 'right_only'")
Compare two csv files with python pandas