Skip to content

Commit

Permalink
update doc-strings
Browse files Browse the repository at this point in the history
  • Loading branch information
jreback committed Jul 24, 2017
1 parent 049d702 commit 9f37949
Show file tree
Hide file tree
Showing 7 changed files with 62 additions and 12 deletions.
2 changes: 2 additions & 0 deletions doc/source/api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,9 @@ Top-level missing data
:toctree: generated/

isna
isnull
notna
notnull

Top-level conversions
~~~~~~~~~~~~~~~~~~~~~
Expand Down
8 changes: 5 additions & 3 deletions pandas/core/categorical.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
"""
Expand All @@ -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.
Expand All @@ -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
"""
Expand Down
2 changes: 2 additions & 0 deletions pandas/core/dtypes/missing.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ def isna(obj):
See also
--------
pandas.notna: boolean inverse of pandas.isna
pandas.isnull: alias of isna
"""
return _isna(obj)

Expand Down Expand Up @@ -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):
Expand Down
16 changes: 16 additions & 0 deletions pandas/core/frame.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
"""
Expand Down
22 changes: 16 additions & 6 deletions pandas/core/generic.py
Original file line number Diff line number Diff line change
Expand Up @@ -4456,27 +4456,37 @@ 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
not na.
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
Expand Down
8 changes: 5 additions & 3 deletions pandas/core/indexes/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
16 changes: 16 additions & 0 deletions pandas/core/series.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 9f37949

Please sign in to comment.