File tree 1 file changed +11
-3
lines changed
1 file changed +11
-3
lines changed Original file line number Diff line number Diff line change @@ -231,7 +231,8 @@ def _maybe_get_mask(
231
231
"""
232
232
if mask is None :
233
233
if is_bool_dtype (values .dtype ) or is_integer_dtype (values .dtype ):
234
- return np .broadcast_to (False , values .shape )
234
+ # Boolean data cannot contain nulls, so signal via mask being None
235
+ return None
235
236
236
237
if skipna or needs_i8_conversion (values .dtype ):
237
238
mask = isna (values )
@@ -1376,8 +1377,15 @@ def _maybe_null_out(
1376
1377
Dtype
1377
1378
The product of all elements on a given axis. ( NaNs are treated as 1)
1378
1379
"""
1379
- if mask is not None and axis is not None and getattr (result , "ndim" , False ):
1380
- null_mask = (mask .shape [axis ] - mask .sum (axis ) - min_count ) < 0
1380
+ if axis is not None and isinstance (result , np .ndarray ):
1381
+ if mask is not None :
1382
+ null_mask = (mask .shape [axis ] - mask .sum (axis ) - min_count ) < 0
1383
+ else :
1384
+ # we have no nulls, kept mask=None in _maybe_get_mask
1385
+ below_count = shape [axis ] - min_count < 0
1386
+ new_shape = shape [:axis ] + shape [axis + 1 :]
1387
+ null_mask = np .broadcast_to (below_count , new_shape )
1388
+
1381
1389
if np .any (null_mask ):
1382
1390
if is_numeric_dtype (result ):
1383
1391
if np .iscomplexobj (result ):
You can’t perform that action at this time.
0 commit comments