From c46c0127bab59ad109f7efed3487226009a307b8 Mon Sep 17 00:00:00 2001 From: Thierry Moisan Date: Mon, 26 Nov 2018 20:14:01 -0500 Subject: [PATCH] DOC: fix DataFrame.replace and DataFrame.set_index --- ci/code_checks.sh | 2 +- pandas/core/frame.py | 4 ---- pandas/core/generic.py | 16 ++++++++-------- 3 files changed, 9 insertions(+), 13 deletions(-) diff --git a/ci/code_checks.sh b/ci/code_checks.sh index 45cb1708258d7..5d0356dc8be9c 100755 --- a/ci/code_checks.sh +++ b/ci/code_checks.sh @@ -147,7 +147,7 @@ if [[ -z "$CHECK" || "$CHECK" == "doctests" ]]; then MSG='Doctests frame.py' ; echo $MSG pytest -q --doctest-modules pandas/core/frame.py \ - -k"-axes -combine -itertuples -join -pivot_table -quantile -query -reindex -reindex_axis -replace -round -set_index -stack" + -k"-axes -combine -itertuples -join -pivot_table -quantile -query -reindex -reindex_axis -round" RET=$(($RET + $?)) ; echo $MSG "DONE" MSG='Doctests series.py' ; echo $MSG diff --git a/pandas/core/frame.py b/pandas/core/frame.py index 592825a7ea63b..0d962a7e05cb0 100644 --- a/pandas/core/frame.py +++ b/pandas/core/frame.py @@ -3955,10 +3955,6 @@ def set_index(self, keys, drop=True, append=False, inplace=False, DataFrame.reindex : Change to new indices or expand indices. DataFrame.reindex_like : Change to same indices as other DataFrame. - Returns - ------- - DataFrame - Examples -------- >>> df = pd.DataFrame({'month': [1, 4, 7, 10], diff --git a/pandas/core/generic.py b/pandas/core/generic.py index e8402e7eefd90..76b448c83d224 100644 --- a/pandas/core/generic.py +++ b/pandas/core/generic.py @@ -5949,7 +5949,7 @@ def bfill(self, axis=None, inplace=False, limit=None, downcast=None): value to use for each column (columns not in the dict will not be filled). Regular expressions, strings and lists or dicts of such objects are also allowed. - inplace : boolean, default False + inplace : bool, default False If True, in place. Note: this will modify any other views on this object (e.g. a column from a DataFrame). Returns the caller if this is True. @@ -5968,12 +5968,6 @@ def bfill(self, axis=None, inplace=False, limit=None, downcast=None): .. versionchanged:: 0.23.0 Added to DataFrame. - See Also - -------- - %(klass)s.fillna : Fill NA values. - %(klass)s.where : Replace values based on boolean condition. - Series.str.replace : Simple string replacement. - Returns ------- %(klass)s @@ -5997,6 +5991,12 @@ def bfill(self, axis=None, inplace=False, limit=None, downcast=None): * If a ``list`` or an ``ndarray`` is passed to `to_replace` and `value` but they are not the same length. + See Also + -------- + %(klass)s.fillna : Fill NA values. + %(klass)s.where : Replace values based on boolean condition. + Series.str.replace : Simple string replacement. + Notes ----- * Regex substitution is performed under the hood with ``re.sub``. The @@ -6111,7 +6111,7 @@ def bfill(self, axis=None, inplace=False, limit=None, downcast=None): 1 foo new 2 bait xyz - >>> df.replace(regex={r'^ba.$':'new', 'foo':'xyz'}) + >>> df.replace(regex={r'^ba.$': 'new', 'foo': 'xyz'}) A B 0 new abc 1 xyz new