From 6a37909bf6a931ef2ea58635e568d2d3cc21f4af Mon Sep 17 00:00:00 2001 From: MomIsBestFriend <> Date: Tue, 31 Mar 2020 13:50:51 +0300 Subject: [PATCH 1/4] DOC: Fix examples in pandas/core/ops/ --- ci/code_checks.sh | 4 ++++ pandas/core/ops/missing.py | 4 +++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/ci/code_checks.sh b/ci/code_checks.sh index 5401cc81785ab..6bb618676138b 100755 --- a/ci/code_checks.sh +++ b/ci/code_checks.sh @@ -308,6 +308,10 @@ if [[ -z "$CHECK" || "$CHECK" == "doctests" ]]; then pytest -q --doctest-modules pandas/core/arrays/boolean.py RET=$(($RET + $?)) ; echo $MSG "DONE" + MSG='Doctests ops' ; echo $MSG + pytest -q --doctest-modules pandas/core/ops/ + RET=$(($RET + $?)) ; echo $MSG "DONE" + MSG='Doctests base.py' ; echo $MSG pytest -q --doctest-modules pandas/core/base.py RET=$(($RET + $?)) ; echo $MSG "DONE" diff --git a/pandas/core/ops/missing.py b/pandas/core/ops/missing.py index 854d6072eea36..049dd17983241 100644 --- a/pandas/core/ops/missing.py +++ b/pandas/core/ops/missing.py @@ -88,8 +88,10 @@ def mask_zero_div_zero(x, y, result): Examples -------- >>> x = np.array([1, 0, -1], dtype=np.int64) + >>> x + array([ 1, 0, -1]) >>> y = 0 # int 0; numpy behavior is different with float - >>> result = x / y + >>> result = x // y >>> result # raw numpy result does not fill division by zero array([0, 0, 0]) >>> mask_zero_div_zero(x, y, result) From 11be8c87510194f7e2b8048bb472ecff683ca9f7 Mon Sep 17 00:00:00 2001 From: MomIsBestFriend <> Date: Wed, 1 Apr 2020 22:15:03 +0300 Subject: [PATCH 2/4] Fixed changes made due merge conflict --- ci/code_checks.sh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/ci/code_checks.sh b/ci/code_checks.sh index d30785d675788..a5113464c7931 100755 --- a/ci/code_checks.sh +++ b/ci/code_checks.sh @@ -299,6 +299,10 @@ if [[ -z "$CHECK" || "$CHECK" == "doctests" ]]; then pytest -q --doctest-modules pandas/core/dtypes/ RET=$(($RET + $?)) ; echo $MSG "DONE" + MSG='Doctests ops' ; echo $MSG + pytest -q --doctest-modules pandas/core/ops/ + RET=$(($RET + $?)) ; echo $MSG "DONE" + MSG='Doctests base.py' ; echo $MSG pytest -q --doctest-modules pandas/core/base.py RET=$(($RET + $?)) ; echo $MSG "DONE" From e3a1c71f16edc9ba12fdde248fb5b423e30a9627 Mon Sep 17 00:00:00 2001 From: MomIsBestFriend <> Date: Fri, 3 Apr 2020 17:19:30 +0300 Subject: [PATCH 3/4] Fixed changes, made due the merge conflict --- ci/code_checks.sh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/ci/code_checks.sh b/ci/code_checks.sh index e987e147fa343..3e9138814fbdf 100755 --- a/ci/code_checks.sh +++ b/ci/code_checks.sh @@ -310,7 +310,11 @@ if [[ -z "$CHECK" || "$CHECK" == "doctests" ]]; then pytest -q --doctest-modules pandas/core/indexes/ RET=$(($RET + $?)) ; echo $MSG "DONE" - MSG='Doctests reshaping functions' ; echo $MSG + MSG='Doctests ops' ; echo $MSG + pytest -q --doctest-modules pandas/core/ops/ + RET=$(($RET + $?)) ; echo $MSG "DONE" + + MSG='Doctests reshape' ; echo $MSG pytest -q --doctest-modules pandas/core/reshape/ RET=$(($RET + $?)) ; echo $MSG "DONE" From 707c644b78e1f8e91e0dd899e8850c4445de63ee Mon Sep 17 00:00:00 2001 From: MomIsBestFriend <> Date: Fri, 3 Apr 2020 17:27:26 +0300 Subject: [PATCH 4/4] Updated docstring --- pandas/core/ops/missing.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pandas/core/ops/missing.py b/pandas/core/ops/missing.py index 049dd17983241..c33cb32dcec19 100644 --- a/pandas/core/ops/missing.py +++ b/pandas/core/ops/missing.py @@ -72,7 +72,7 @@ def fill_zeros(result, x, y): def mask_zero_div_zero(x, y, result): """ - Set results of 0 / 0 or 0 // 0 to np.nan, regardless of the dtypes + Set results of 0 // 0 to np.nan, regardless of the dtypes of the numerator or the denominator. Parameters @@ -83,7 +83,8 @@ def mask_zero_div_zero(x, y, result): Returns ------- - filled_result : ndarray + ndarray + The filled result. Examples --------