Skip to content

Commit 02a134b

Browse files
authored
DOC: Fix examples in pandas/core/ops/ (#33176)
1 parent 66e4517 commit 02a134b

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

ci/code_checks.sh

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -310,7 +310,11 @@ if [[ -z "$CHECK" || "$CHECK" == "doctests" ]]; then
310310
pytest -q --doctest-modules pandas/core/indexes/
311311
RET=$(($RET + $?)) ; echo $MSG "DONE"
312312

313-
MSG='Doctests reshaping functions' ; echo $MSG
313+
MSG='Doctests ops' ; echo $MSG
314+
pytest -q --doctest-modules pandas/core/ops/
315+
RET=$(($RET + $?)) ; echo $MSG "DONE"
316+
317+
MSG='Doctests reshape' ; echo $MSG
314318
pytest -q --doctest-modules pandas/core/reshape/
315319
RET=$(($RET + $?)) ; echo $MSG "DONE"
316320

pandas/core/ops/missing.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ def fill_zeros(result, x, y):
7272

7373
def mask_zero_div_zero(x, y, result):
7474
"""
75-
Set results of 0 / 0 or 0 // 0 to np.nan, regardless of the dtypes
75+
Set results of 0 // 0 to np.nan, regardless of the dtypes
7676
of the numerator or the denominator.
7777
7878
Parameters
@@ -83,13 +83,16 @@ def mask_zero_div_zero(x, y, result):
8383
8484
Returns
8585
-------
86-
filled_result : ndarray
86+
ndarray
87+
The filled result.
8788
8889
Examples
8990
--------
9091
>>> x = np.array([1, 0, -1], dtype=np.int64)
92+
>>> x
93+
array([ 1, 0, -1])
9194
>>> y = 0 # int 0; numpy behavior is different with float
92-
>>> result = x / y
95+
>>> result = x // y
9396
>>> result # raw numpy result does not fill division by zero
9497
array([0, 0, 0])
9598
>>> mask_zero_div_zero(x, y, result)

0 commit comments

Comments
 (0)