check for identical rows in different numpy arrays

后端 未结 6 790
无人共我
无人共我 2020-11-28 15:14

how do I get a row-wise comparison between two arrays, in the result of a row-wise true/false array?

Given datas:

a = np.array([[1,0],[2,0],[3,1],[         


        
6条回答
  •  旧巷少年郎
    2020-11-28 15:46

    You can do it as a list comp via:

    c = np.array([row in b for row in a])
    

    though this approach will be slower than a pure numpy approach (if it exists).

提交回复
热议问题