Skip to content

Commit

Permalink
Add mask for NA to _arith_method
Browse files Browse the repository at this point in the history
  • Loading branch information
cooolheater committed Oct 11, 2024
1 parent 218e5cd commit c73603f
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
3 changes: 0 additions & 3 deletions pandas/core/array_algos/masked_reductions.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@

from pandas._libs import missing as libmissing

from pandas.core.missing import isna
from pandas.core.nanops import check_below_min_count

if TYPE_CHECKING:
Expand Down Expand Up @@ -58,8 +57,6 @@ def _reductions(
else:
return func(values, axis=axis, **kwargs)
else:
mask |= isna(values)

if check_below_min_count(values.shape, mask, min_count) and (
axis is None or values.ndim == 1
):
Expand Down
2 changes: 2 additions & 0 deletions pandas/core/arrays/masked.py
Original file line number Diff line number Diff line change
Expand Up @@ -767,6 +767,8 @@ def _arith_method(self, other, op):

with np.errstate(all="ignore"):
result = pd_op(self._data, other)
if op_name == "truediv":
mask |= isna(result)

if op_name == "pow":
# 1 ** x is 1.
Expand Down

0 comments on commit c73603f

Please sign in to comment.