'numpy.ndarray' object has no attribute 'isnull'
时间: 2023-10-30 13:01:28 浏览: 421
'numpy.ndarray' object does not have the 'isnull' attribute. The 'isnull' function is a part of the pandas library and can be used to check for missing values in a pandas DataFrame or Series.
If you have a numpy array and want to check for missing values, you can use the 'numpy.isnan' function instead. It returns a boolean array indicating whether each element in the array is NaN (Not a Number) or not.
Here's an example of how you can use 'numpy.isnan' to check for missing values in a numpy array:
```python
import numpy as np
arr = np.array([1, 2, np.nan, 4, 5])
is_missing = np.isnan(arr)
print(is_missing)
```
This will output:
```
[False False True False False]
```
In this example, the element at index 2 is NaN, so the corresponding value in the 'is_missing' array is 'True'.
阅读全文