However, the presence of elements of type str in your array means that np.isnan() will raise an exception:
TypeError: ufunc 'isnan' not supported for the input types, and the inputs could not be safely coerced to any supported types according to the casting rule ''safe''
Here is a simple way to do what you're asking:
Output:
Note that if your values were numeric, you could use
np.isnan()
for vectorized boolean indexing like this:Input:
{'test1': array([ 1., 2., 3., 4., 5., 6., nan, 7.])}
Output:
{'test1': array([1., 2., 3., 4., 5., 6., 7.])}
However, the presence of elements of type
str
in your array means thatnp.isnan()
will raise an exception: