Skip to content

Commit 289022f

Browse files
committed
added empty values check
1 parent b93948a commit 289022f

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

pandas/core/array_algos/masked_reductions.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,8 @@ def max(values: np.ndarray, mask: np.ndarray, *, skipna: bool = True):
110110

111111

112112
def mean(values: np.ndarray, mask: np.ndarray, skipna: bool = True):
113-
113+
if not values.size:
114+
return libmissing.NA
114115
_sum = _sumprod(np.sum, values=values, mask=mask, skipna=skipna)
115116
count = np.count_nonzero(~mask)
116117
mean_value = _sum / count

0 commit comments

Comments
 (0)