Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DOC: fix DataFrame.replace and DataFrame.set_index docstrings #23939

Merged
merged 1 commit into from
Nov 29, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion ci/code_checks.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 0 additions & 4 deletions pandas/core/frame.py
Original file line number Diff line number Diff line change
Expand Up @@ -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],
Expand Down
16 changes: 8 additions & 8 deletions pandas/core/generic.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down