Skip to content

Commit d7a392d

Browse files
committed
TST: resample does not yield empty groups (#10603)
1 parent 6b24380 commit d7a392d

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

pandas/tests/resample/test_timedelta.py

+12
Original file line numberDiff line numberDiff line change
@@ -150,3 +150,15 @@ def test_resample_timedelta_edge_case(start, end, freq, resample_freq):
150150
tm.assert_index_equal(result.index, expected_index)
151151
assert result.index.freq == expected_index.freq
152152
assert not np.isnan(result[-1])
153+
154+
155+
def test_resample_timedelta_no_empty_groups():
156+
# GH 10603
157+
# check that resample does not yield empty groups
158+
df = pd.DataFrame(np.random.normal(size=(10000, 4)))
159+
df.index = pd.timedelta_range(start="0s", periods=10000, freq="3906250n")
160+
result = df.loc["1s":, :].resample("3s").apply(lambda x: len(x))
161+
162+
expected = pd.DataFrame([[768.0] * 4] * 12 + [[528.0] * 4])
163+
expected.index = pd.timedelta_range(start="1s", periods=13, freq="3s")
164+
tm.assert_frame_equal(result, expected)

0 commit comments

Comments
 (0)