Skip to content

Commit 1b8034c

Browse files
committed
DOC: Updated Series.replace docs (pandas-dev#17226)
1 parent 6b4346a commit 1b8034c

File tree

1 file changed

+11
-17
lines changed

1 file changed

+11
-17
lines changed

pandas/core/generic.py

+11-17
Original file line numberDiff line numberDiff line change
@@ -4108,14 +4108,11 @@ def replace(self, to_replace=None, value=None, inplace=False, limit=None,
41084108
41094109
* dict:
41104110
4111-
- Nested dictionaries, e.g., {'a': {'b': nan}}, are read as
4112-
follows: look in column 'a' for the value 'b' and replace it
4113-
with nan. You can nest regular expressions as well. Note that
4114-
column names (the top-level dictionary keys in a nested
4115-
dictionary) **cannot** be regular expressions.
4116-
- Keys map to column names and values map to substitution
4117-
values. You can treat this as a special case of passing two
4118-
lists except that you are specifying the column to search in.
4111+
- Dictionaries, e.g., {'a': 'b'}, are read as
4112+
follows: look for the value 'a' and replace it
4113+
with 'b'.
4114+
- Keys map to Series values and values map to substitution
4115+
values.
41194116
41204117
* None:
41214118
@@ -4126,13 +4123,10 @@ def replace(self, to_replace=None, value=None, inplace=False, limit=None,
41264123
41274124
See the examples section for examples of each of these.
41284125
value : scalar, dict, list, str, regex, default None
4129-
Value to use to fill holes (e.g. 0), alternately a dict of values
4130-
specifying which value to use for each column (columns not in the
4131-
dict will not be filled). Regular expressions, strings and lists or
4126+
Value to use to fill holes (e.g. 0). Regular expressions, strings and lists or
41324127
dicts of such objects are also allowed.
41334128
inplace : boolean, default False
4134-
If True, in place. Note: this will modify any
4135-
other views on this object (e.g. a column form a DataFrame).
4129+
If True, in place.
41364130
Returns the caller if this is True.
41374131
limit : int, default None
41384132
Maximum size gap to forward or backward fill
@@ -4148,13 +4142,13 @@ def replace(self, to_replace=None, value=None, inplace=False, limit=None,
41484142
41494143
See Also
41504144
--------
4151-
NDFrame.reindex
4152-
NDFrame.asfreq
4153-
NDFrame.fillna
4145+
Series.reindex
4146+
Series.asfreq
4147+
Series.fillna
41544148
41554149
Returns
41564150
-------
4157-
filled : NDFrame
4151+
filled : Series
41584152
41594153
Raises
41604154
------

0 commit comments

Comments
 (0)