Skip to content

Commit 1739199

Browse files
Revert "PERF: reductions (#41911)" (#41923)
This reverts commit c8e23d2.
1 parent c8e23d2 commit 1739199

File tree

1 file changed

+3
-10
lines changed

1 file changed

+3
-10
lines changed

pandas/core/nanops.py

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,7 @@ def _maybe_get_mask(
245245
"""
246246
if mask is None:
247247
if is_bool_dtype(values.dtype) or is_integer_dtype(values.dtype):
248-
return None
248+
return np.broadcast_to(False, values.shape)
249249

250250
if skipna or needs_i8_conversion(values.dtype):
251251
mask = isna(values)
@@ -1435,15 +1435,8 @@ def _maybe_null_out(
14351435
Dtype
14361436
The product of all elements on a given axis. ( NaNs are treated as 1)
14371437
"""
1438-
if axis is not None and isinstance(result, np.ndarray):
1439-
if mask is not None:
1440-
null_mask = (mask.shape[axis] - mask.sum(axis) - min_count) < 0
1441-
else:
1442-
# we have no nulls, kept mask=None in _maybe_get_mask
1443-
below_count = shape[axis] - min_count < 0
1444-
new_shape = shape[:axis] + shape[axis + 1 :]
1445-
null_mask = np.broadcast_to(below_count, new_shape)
1446-
1438+
if mask is not None and axis is not None and isinstance(result, np.ndarray):
1439+
null_mask = (mask.shape[axis] - mask.sum(axis) - min_count) < 0
14471440
if np.any(null_mask):
14481441
if is_numeric_dtype(result):
14491442
if np.iscomplexobj(result):

0 commit comments

Comments
 (0)