Skip to content

Commit ebf1d36

Browse files
committed
testcase for pandas-dev#33168 addressing review comments
1 parent 8b331a4 commit ebf1d36

File tree

1 file changed

+12
-28
lines changed

1 file changed

+12
-28
lines changed

pandas/tests/groupby/test_quantile.py

Lines changed: 12 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -350,44 +350,28 @@ def test_timestamp_groupby_quantile():
350350
df = DataFrame(
351351
{
352352
"timestamp": pd.date_range(
353-
start="2020-04-19 00:00:00", freq="1T", periods=200, tz="UTC"
353+
start="2020-04-19 00:00:00", freq="1T", periods=100, tz="UTC"
354354
).floor("1H"),
355-
"category": list(range(1, 201)),
356-
"value": list(range(201, 401)),
355+
"category": list(range(1, 101)),
356+
"value": list(range(101, 201)),
357357
}
358358
)
359359

360-
result = df.groupby("timestamp").quantile([0.1, 0.5, 0.9])
360+
result = df.groupby("timestamp").quantile([0.2, 0.8])
361361

362362
expected = DataFrame(
363363
[
364-
{"category": 6.9, "value": 206.9},
365-
{"category": 30.5, "value": 230.5},
366-
{"category": 54.1, "value": 254.1},
367-
{"category": 66.9, "value": 266.9},
368-
{"category": 90.5, "value": 290.5},
369-
{"category": 114.1, "value": 314.1},
370-
{"category": 126.9, "value": 326.9},
371-
{"category": 150.5, "value": 350.5},
372-
{"category": 174.1, "value": 374.1},
373-
{"category": 182.9, "value": 382.9},
374-
{"category": 190.5, "value": 390.5},
375-
{"category": 198.1, "value": 398.1},
364+
{"category": 12.8, "value": 112.8},
365+
{"category": 48.2, "value": 148.2},
366+
{"category": 68.8, "value": 168.8},
367+
{"category": 92.2, "value": 192.2},
376368
],
377369
index=pd.MultiIndex.from_tuples(
378370
[
379-
(pd.Timestamp("2020-04-19 00:00:00+00:00"), 0.1),
380-
(pd.Timestamp("2020-04-19 00:00:00+00:00"), 0.5),
381-
(pd.Timestamp("2020-04-19 00:00:00+00:00"), 0.9),
382-
(pd.Timestamp("2020-04-19 01:00:00+00:00"), 0.1),
383-
(pd.Timestamp("2020-04-19 01:00:00+00:00"), 0.5),
384-
(pd.Timestamp("2020-04-19 01:00:00+00:00"), 0.9),
385-
(pd.Timestamp("2020-04-19 02:00:00+00:00"), 0.1),
386-
(pd.Timestamp("2020-04-19 02:00:00+00:00"), 0.5),
387-
(pd.Timestamp("2020-04-19 02:00:00+00:00"), 0.9),
388-
(pd.Timestamp("2020-04-19 03:00:00+00:00"), 0.1),
389-
(pd.Timestamp("2020-04-19 03:00:00+00:00"), 0.5),
390-
(pd.Timestamp("2020-04-19 03:00:00+00:00"), 0.9),
371+
(pd.Timestamp("2020-04-19 00:00:00+00:00"), 0.2),
372+
(pd.Timestamp("2020-04-19 00:00:00+00:00"), 0.8),
373+
(pd.Timestamp("2020-04-19 01:00:00+00:00"), 0.2),
374+
(pd.Timestamp("2020-04-19 01:00:00+00:00"), 0.8),
391375
],
392376
names=("timestamp", None),
393377
),

0 commit comments

Comments
 (0)