Skip to content

Commit 79e3381

Browse files
committed
add test
1 parent 15aa86e commit 79e3381

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

pandas/tests/test_nanops.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1095,6 +1095,18 @@ def test_nans_skipna(self, samples, actual_kurt):
10951095
kurt = nanops.nankurt(samples, skipna=True)
10961096
tm.assert_almost_equal(kurt, actual_kurt)
10971097

1098+
def test_small_arrays_with_low_variance(self):
1099+
# GH-57972
1100+
# small sample arrays with low variance have a lower threshold for breakdown
1101+
# of numerical stability and should be handled accordingly
1102+
low_var_samples = np.array(
1103+
[-2.05191341e-05] + [0.0e00] * 4 + [-4.10391103e-05] + [0.0e00] * 23
1104+
)
1105+
# calculated with scipy.status kurtosis(low_var_samples, bias=False)
1106+
scipy_kurt = 18.087646853025614
1107+
kurt = nanops.nankurt(low_var_samples)
1108+
tm.assert_almost_equal(kurt, scipy_kurt)
1109+
10981110
@property
10991111
def prng(self):
11001112
return np.random.default_rng(2)

0 commit comments

Comments
 (0)