Skip to content

Commit 2e67416

Browse files
committed
add comment and code path
1 parent 79e3381 commit 2e67416

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

pandas/_libs/window/aggregations.pyx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -508,6 +508,7 @@ cdef float64_t calc_skew(int64_t minp, int64_t nobs,
508508
# if the variance is less than 1e-14, it could be
509509
# treat as zero, here we follow the original
510510
# skew/kurt behaviour to check B <= 1e-14
511+
# #57972: for small arrays the cutoff can be lowered
511512
elif B <= 1e-14 and nobs > 100 or B <= 1e-16:
512513
result = NaN
513514
else:
@@ -712,7 +713,8 @@ cdef float64_t calc_kurt(int64_t minp, int64_t nobs,
712713
# if the variance is less than 1e-14, it could be
713714
# treat as zero, here we follow the original
714715
# skew/kurt behaviour to check B <= 1e-14
715-
if B <= 1e-14:
716+
# #57972: for small arrays the cutoff can be lowered
717+
if B <= 1e-14 and nobs > 100 or B <= 1e-16:
716718
result = NaN
717719
else:
718720
K = (dnobs * dnobs - 1.) * D / (B * B) - 3 * ((dnobs - 1.) ** 2)

0 commit comments

Comments
 (0)