Detect missing values. Return a boolean same-sized object indicating if the values are NA. NA values, such as ``None``, :attr:`numpy.NaN` or :attr:`pd.NaT`, get mapped to ``True`` values. Everything else get mapped to ``False`` values. Characters such as
(self)
| 2638 | |
| 2639 | @final |
| 2640 | def isna(self) -> npt.NDArray[np.bool_]: |
| 2641 | """ |
| 2642 | Detect missing values. |
| 2643 | |
| 2644 | Return a boolean same-sized object indicating if the values are NA. |
| 2645 | NA values, such as ``None``, :attr:`numpy.NaN` or :attr:`pd.NaT`, get |
| 2646 | mapped to ``True`` values. |
| 2647 | Everything else get mapped to ``False`` values. Characters such as |
| 2648 | empty strings `''` or :attr:`numpy.inf` are not considered NA values. |
| 2649 | |
| 2650 | Returns |
| 2651 | ------- |
| 2652 | numpy.ndarray[bool] |
| 2653 | A boolean array of whether my values are NA. |
| 2654 | |
| 2655 | See Also |
| 2656 | -------- |
| 2657 | Index.notna : Boolean inverse of isna. |
| 2658 | Index.dropna : Omit entries with missing values. |
| 2659 | isna : Top-level isna. |
| 2660 | Series.isna : Detect missing values in Series object. |
| 2661 | |
| 2662 | Examples |
| 2663 | -------- |
| 2664 | Show which entries in a pandas.Index are NA. The result is an |
| 2665 | array. |
| 2666 | |
| 2667 | >>> idx = pd.Index([5.2, 6.0, np.nan]) |
| 2668 | >>> idx |
| 2669 | Index([5.2, 6.0, nan], dtype='float64') |
| 2670 | >>> idx.isna() |
| 2671 | array([False, False, True]) |
| 2672 | |
| 2673 | Empty strings are not considered NA values. None is considered an NA |
| 2674 | value. |
| 2675 | |
| 2676 | >>> idx = pd.Index(["black", "", "red", None]) |
| 2677 | >>> idx |
| 2678 | Index(['black', '', 'red', nan], dtype='str') |
| 2679 | >>> idx.isna() |
| 2680 | array([False, False, False, True]) |
| 2681 | |
| 2682 | For datetimes, `NaT` (Not a Time) is considered as an NA value. |
| 2683 | |
| 2684 | >>> idx = pd.DatetimeIndex( |
| 2685 | ... [pd.Timestamp("1940-04-25"), pd.Timestamp(""), None, pd.NaT] |
| 2686 | ... ) |
| 2687 | >>> idx |
| 2688 | DatetimeIndex(['1940-04-25', 'NaT', 'NaT', 'NaT'], |
| 2689 | dtype='datetime64[us]', freq=None) |
| 2690 | >>> idx.isna() |
| 2691 | array([False, True, True, True]) |
| 2692 | """ |
| 2693 | return self._isnan |
| 2694 | |
| 2695 | isnull = isna |
| 2696 |
no outgoing calls