File tree 1 file changed +10
-3
lines changed
1 file changed +10
-3
lines changed Original file line number Diff line number Diff line change @@ -245,7 +245,7 @@ def _maybe_get_mask(
245
245
"""
246
246
if mask is None :
247
247
if is_bool_dtype (values .dtype ) or is_integer_dtype (values .dtype ):
248
- return np . broadcast_to ( False , values . shape )
248
+ return None
249
249
250
250
if skipna or needs_i8_conversion (values .dtype ):
251
251
mask = isna (values )
@@ -1435,8 +1435,15 @@ def _maybe_null_out(
1435
1435
Dtype
1436
1436
The product of all elements on a given axis. ( NaNs are treated as 1)
1437
1437
"""
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
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
+
1440
1447
if np .any (null_mask ):
1441
1448
if is_numeric_dtype (result ):
1442
1449
if np .iscomplexobj (result ):
You can’t perform that action at this time.
0 commit comments