diff --git a/doc/source/api.rst b/doc/source/api.rst index a365b874f095d..f64f088e3c8f0 100644 --- a/doc/source/api.rst +++ b/doc/source/api.rst @@ -188,7 +188,9 @@ Top-level missing data :toctree: generated/ isna + isnull notna + notnull Top-level conversions ~~~~~~~~~~~~~~~~~~~~~ diff --git a/pandas/core/categorical.py b/pandas/core/categorical.py index 3ef720856f90c..1392ad2f011db 100644 --- a/pandas/core/categorical.py +++ b/pandas/core/categorical.py @@ -1165,7 +1165,8 @@ def isna(self): See also -------- - isna : pandas version + isna : top-level isna + isnull : alias of isna Categorical.notna : boolean inverse of Categorical.isna """ @@ -1183,7 +1184,7 @@ def isna(self): def notna(self): """ - Reverse of isna + Inverse of isna Both missing values (-1 in .codes) and NA as a category are detected as null. @@ -1194,7 +1195,8 @@ def notna(self): See also -------- - notna : pandas version + notna : top-level notna + notnull : alias of notna Categorical.isna : boolean inverse of Categorical.notna """ diff --git a/pandas/core/dtypes/missing.py b/pandas/core/dtypes/missing.py index 7611c762540fb..101612893cb02 100644 --- a/pandas/core/dtypes/missing.py +++ b/pandas/core/dtypes/missing.py @@ -40,6 +40,7 @@ def isna(obj): See also -------- pandas.notna: boolean inverse of pandas.isna + pandas.isnull: alias of isna """ return _isna(obj) @@ -206,6 +207,7 @@ def notna(obj): See also -------- pandas.isna : boolean inverse of pandas.notna + pandas.notnull : alias of notna """ res = isna(obj) if is_scalar(res): diff --git a/pandas/core/frame.py b/pandas/core/frame.py index 5eb6645ef78fb..6c72fa648559a 100644 --- a/pandas/core/frame.py +++ b/pandas/core/frame.py @@ -3205,6 +3205,22 @@ def _maybe_casted_values(index, labels=None): # ---------------------------------------------------------------------- # Reindex-based selection methods + @Appender(_shared_docs['isna'] % _shared_doc_kwargs) + def isna(self): + return super(DataFrame, self).isna() + + @Appender(_shared_docs['isna'] % _shared_doc_kwargs) + def isnull(self): + return super(DataFrame, self).isnull() + + @Appender(_shared_docs['isna'] % _shared_doc_kwargs) + def notna(self): + return super(DataFrame, self).notna() + + @Appender(_shared_docs['notna'] % _shared_doc_kwargs) + def notnull(self): + return super(DataFrame, self).notnull() + def dropna(self, axis=0, how='any', thresh=None, subset=None, inplace=False): """ diff --git a/pandas/core/generic.py b/pandas/core/generic.py index e1a8c54a1d4f5..8842e6f7bde16 100644 --- a/pandas/core/generic.py +++ b/pandas/core/generic.py @@ -4456,13 +4456,18 @@ def asof(self, where, subset=None): See Also -------- - notna : boolean inverse of isna + %(klass)s.notna : boolean inverse of isna + %(klass)s.isnull : alias of isna + isna : top-level isna """ - @Appender(_shared_docs['isna']) + @Appender(_shared_docs['isna'] % _shared_doc_kwargs) def isna(self): return isna(self).__finalize__(self) - isnull = isna + + @Appender(_shared_docs['isna'] % _shared_doc_kwargs) + def isnull(self): + return isna(self).__finalize__(self) _shared_docs['notna'] = """ Return a boolean same-sized object indicating if the values are @@ -4470,13 +4475,18 @@ def isna(self): See Also -------- - isna : boolean inverse of notna + %(klass)s.isna : boolean inverse of notna + %(klass)s.notnull : alias of notna + notna : top-level notna """ - @Appender(_shared_docs['notna']) + @Appender(_shared_docs['notna'] % _shared_doc_kwargs) def notna(self): return notna(self).__finalize__(self) - notnull = notna + + @Appender(_shared_docs['notna'] % _shared_doc_kwargs) + def notnull(self): + return notna(self).__finalize__(self) def _clip_with_scalar(self, lower, upper, inplace=False): if ((lower is not None and np.any(isna(lower))) or diff --git a/pandas/core/indexes/base.py b/pandas/core/indexes/base.py index 931e6df78ebee..fd9abcfb726bf 100644 --- a/pandas/core/indexes/base.py +++ b/pandas/core/indexes/base.py @@ -1856,14 +1856,15 @@ def isna(self): See also -------- - pandas.isna : pandas version + isnull : alias of isna + pandas.isna : top-level isna """ return self._isnan isnull = isna def notna(self): """ - Reverse of isna + Inverse of isna .. versionadded:: 0.20.0 @@ -1873,7 +1874,8 @@ def notna(self): See also -------- - pandas.notna : pandas version + notnull : alias of notna + pandas.notna : top-level notna """ return ~self.isna() notnull = notna diff --git a/pandas/core/series.py b/pandas/core/series.py index 3abd8a8e9350e..fb5819b2748a0 100644 --- a/pandas/core/series.py +++ b/pandas/core/series.py @@ -2784,6 +2784,22 @@ def to_excel(self, excel_writer, sheet_name='Sheet1', na_rep='', merge_cells=merge_cells, encoding=encoding, inf_rep=inf_rep, verbose=verbose) + @Appender(generic._shared_docs['isna'] % _shared_doc_kwargs) + def isna(self): + return super(Series, self).isna() + + @Appender(generic._shared_docs['isna'] % _shared_doc_kwargs) + def isnull(self): + return super(Series, self).isnull() + + @Appender(generic._shared_docs['isna'] % _shared_doc_kwargs) + def notna(self): + return super(Series, self).notna() + + @Appender(generic._shared_docs['notna'] % _shared_doc_kwargs) + def notnull(self): + return super(Series, self).notnull() + def dropna(self, axis=0, inplace=False, **kwargs): """ Return Series without null values