forked from pandas-dev/pandas
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add code sample for pandas-dev#40472
- Loading branch information
1 parent
2714184
commit bc12c51
Showing
1 changed file
with
13 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# BUG: series.replace(np.nan,..) on categorical series does not replace #40472 | ||
|
||
|
||
import numpy as np | ||
import pandas as pd | ||
|
||
print(pd.__version__) | ||
|
||
s = pd.Series({1: np.nan, 2: "b"}).astype("category") | ||
result = s.replace(np.nan, "c") | ||
print(result) | ||
|
||
assert result[1] == "c" |