From aa8f8ef508de1c80c35f23aacef2f67bf46038d1 Mon Sep 17 00:00:00 2001 From: el-iot Date: Thu, 21 Oct 2021 14:27:18 +0800 Subject: [PATCH 1/2] disambiguate documentation for pandas.Series replace --- pandas/core/shared_docs.py | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/pandas/core/shared_docs.py b/pandas/core/shared_docs.py index 9c9e70789390d..3c48772c62858 100644 --- a/pandas/core/shared_docs.py +++ b/pandas/core/shared_docs.py @@ -535,13 +535,13 @@ **Scalar `to_replace` and `value`** - >>> s = pd.Series([0, 1, 2, 3, 4]) - >>> s.replace(0, 5) + >>> s = pd.Series([1, 2, 3, 4, 5]) + >>> s.replace(1, 5) 0 5 - 1 1 - 2 2 - 3 3 - 4 4 + 1 2 + 2 3 + 3 4 + 4 5 dtype: int64 >>> df = pd.DataFrame({{'A': [0, 1, 2, 3, 4], @@ -574,11 +574,11 @@ 4 4 9 e >>> s.replace([1, 2], method='bfill') - 0 0 - 1 3 - 2 3 - 3 3 - 4 4 + 0 1 + 1 4 + 2 4 + 3 4 + 4 5 dtype: int64 **dict-like `to_replace`** From 966911c62f0596e78c2c5fc5e00437958d6d9fb0 Mon Sep 17 00:00:00 2001 From: el-iot Date: Wed, 27 Oct 2021 08:54:43 +0800 Subject: [PATCH 2/2] fix bad replace docs --- pandas/core/shared_docs.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pandas/core/shared_docs.py b/pandas/core/shared_docs.py index 3c48772c62858..bc4f4d657b859 100644 --- a/pandas/core/shared_docs.py +++ b/pandas/core/shared_docs.py @@ -574,9 +574,9 @@ 4 4 9 e >>> s.replace([1, 2], method='bfill') - 0 1 - 1 4 - 2 4 + 0 3 + 1 3 + 2 3 3 4 4 5 dtype: int64