Numpy isnan() fails on an array of floats (from pandas dataframe apply)

后端 未结 4 1047
清酒与你
清酒与你 2020-11-30 21:04

I have an array of floats (some normal numbers, some nans) that is coming out of an apply on a pandas dataframe.

For some reason, numpy.isnan is failing on this arra

4条回答
  •  野性不改
    2020-11-30 21:24

    A great substitute for np.isnan() and pd.isnull() is

    for i in range(0,a.shape[0]):
        if(a[i]!=a[i]):
           //do something here
           //a[i] is nan
    

    since only nan is not equal to itself.

提交回复
热议问题