File tree Expand file tree Collapse file tree 1 file changed +11
-3
lines changed Expand file tree Collapse file tree 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(
231231 """
232232 if mask is None :
233233 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
235236
236237 if skipna or needs_i8_conversion (values .dtype ):
237238 mask = isna (values )
@@ -1376,8 +1377,15 @@ def _maybe_null_out(
13761377 Dtype
13771378 The product of all elements on a given axis. ( NaNs are treated as 1)
13781379 """
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+
13811389 if np .any (null_mask ):
13821390 if is_numeric_dtype (result ):
13831391 if np .iscomplexobj (result ):
You can’t perform that action at this time.
0 commit comments