Find unique rows in numpy.array

后端 未结 20 3125
独厮守ぢ
独厮守ぢ 2020-11-21 10:57

I need to find unique rows in a numpy.array.

For example:

>>> a # I have
array([[1, 1, 1, 0, 0, 0],
       [0, 1, 1, 1, 0, 0],
         


        
20条回答
  •  北荒
    北荒 (楼主)
    2020-11-21 11:58

    Yet another possible solution

    np.vstack({tuple(row) for row in a})
    

提交回复
热议问题