Detect existing (non-missing) values. Return a boolean same-sized object indicating if the values are not NA. Non-missing values get mapped to ``True``. Characters such as empty strings ``''`` or :attr:`numpy.inf` are not considered NA values. NA values, suc
(self)
| 2696 | |
| 2697 | @final |
| 2698 | def notna(self) -> npt.NDArray[np.bool_]: |
| 2699 | """ |
| 2700 | Detect existing (non-missing) values. |
| 2701 | |
| 2702 | Return a boolean same-sized object indicating if the values are not NA. |
| 2703 | Non-missing values get mapped to ``True``. Characters such as empty |
| 2704 | strings ``''`` or :attr:`numpy.inf` are not considered NA values. |
| 2705 | NA values, such as None or :attr:`numpy.NaN`, get mapped to ``False`` |
| 2706 | values. |
| 2707 | |
| 2708 | Returns |
| 2709 | ------- |
| 2710 | numpy.ndarray[bool] |
| 2711 | Boolean array to indicate which entries are not NA. |
| 2712 | |
| 2713 | See Also |
| 2714 | -------- |
| 2715 | Index.notnull : Alias of notna. |
| 2716 | Index.isna: Inverse of notna. |
| 2717 | notna : Top-level notna. |
| 2718 | |
| 2719 | Examples |
| 2720 | -------- |
| 2721 | Show which entries in an Index are not NA. The result is an |
| 2722 | array. |
| 2723 | |
| 2724 | >>> idx = pd.Index([5.2, 6.0, np.nan]) |
| 2725 | >>> idx |
| 2726 | Index([5.2, 6.0, nan], dtype='float64') |
| 2727 | >>> idx.notna() |
| 2728 | array([ True, True, False]) |
| 2729 | |
| 2730 | Empty strings are not considered NA values. None is considered a NA |
| 2731 | value. |
| 2732 | |
| 2733 | >>> idx = pd.Index(["black", "", "red", None]) |
| 2734 | >>> idx |
| 2735 | Index(['black', '', 'red', nan], dtype='str') |
| 2736 | >>> idx.notna() |
| 2737 | array([ True, True, True, False]) |
| 2738 | """ |
| 2739 | return ~self.isna() |
| 2740 | |
| 2741 | notnull = notna |
| 2742 |