Skip to content

Commit 230990d

Browse files
authored
DataFrame.replace with dict doesn't work when value=None (#46930)
* _map_values for Series, na_action must be None or "ignore" * Updating docstring for na_action in Series * Revert to old docstring * Use tuple instead of list * Revert to previous commit * Add test for map with invalid na_action argument * Conforming to pep style * Series.map raises if arg is dict but na_action not None or ignore * Update msg * Update f-string * Use pytest.mark.parametrize * Update variable names * Adding backticks * Removing extraneous comment * value should not be given * Value param should not be specified * Remove trailing whitespace
1 parent 60ac973 commit 230990d

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

pandas/core/shared_docs.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -482,8 +482,8 @@
482482
- Dicts can be used to specify different replacement values
483483
for different existing values. For example,
484484
``{{'a': 'b', 'y': 'z'}}`` replaces the value 'a' with 'b' and
485-
'y' with 'z'. To use a dict in this way the `value`
486-
parameter should be `None`.
485+
'y' with 'z'. To use a dict in this way, the optional `value`
486+
parameter should not be given.
487487
- For a DataFrame a dict can specify that different values
488488
should be replaced in different columns. For example,
489489
``{{'a': 1, 'b': 'z'}}`` looks for the value 1 in column 'a'
@@ -494,8 +494,8 @@
494494
specifying the column to search in.
495495
- For a DataFrame nested dictionaries, e.g.,
496496
``{{'a': {{'b': np.nan}}}}``, are read as follows: look in column
497-
'a' for the value 'b' and replace it with NaN. The `value`
498-
parameter should be ``None`` to use a nested dict in this
497+
'a' for the value 'b' and replace it with NaN. The optional `value`
498+
parameter should not be specified to use a nested dict in this
499499
way. You can nest regular expressions as well. Note that
500500
column names (the top-level dictionary keys in a nested
501501
dictionary) **cannot** be regular expressions.

0 commit comments

Comments
 (0)