creating a boolean array which compares numpy elements to None

后端 未结 1 504
长情又很酷
长情又很酷 2020-12-11 02:12

I have a numpy array with dtype=object, and I want to create a boolean array identifying which elements are None. But it looks like None behaves di

相关标签:
1条回答
  • 2020-12-11 02:32

    You can use numpy.equal:

    In [20]: np.equal(a, None)
    Out[20]: 
    array([False, False, False, False,  True, False, False, False, False,
           False,  True, False], dtype=bool)
    
    0 讨论(0)
提交回复
热议问题