From bc12c51857cc9ce0ca1873d95b8eb34c4b5cd424 Mon Sep 17 00:00:00 2001 From: Simon Hawkins Date: Mon, 7 Jun 2021 19:47:32 +0100 Subject: [PATCH] add code sample for #40472 --- bisect/40472.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 bisect/40472.py diff --git a/bisect/40472.py b/bisect/40472.py new file mode 100644 index 0000000000000..aba2cfbd00ff2 --- /dev/null +++ b/bisect/40472.py @@ -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"