compare one column value with all the values of other column using pandas

前端 未结 1 1480
离开以前
离开以前 2020-12-19 23:10

I have the one excel file which contains the below values

I need to compare a_id value with all the value of b_id and if it matche

相关标签:
1条回答
  • 2020-12-19 23:26

    Use Series.isin for test membership:

    df1['a_flag'] = df3['a_id'].isin(df3['b_id']).astype(int)
    df1['b_flag'] = df3['b_id'].isin(df3['a_id']).astype(int)
    
    0 讨论(0)
提交回复
热议问题