Skip to content

Commit cafdd17

Browse files
committed
Fix precommit checks
1 parent e8070f1 commit cafdd17

File tree

1 file changed

+14
-5
lines changed

1 file changed

+14
-5
lines changed

pandas/tests/groupby/test_grouping.py

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -444,13 +444,22 @@ def test_groupby_grouper_f_sanity_checked(self):
444444

445445
def test_groupby_with_datetime_key(self):
446446
# GH 51158
447-
df = DataFrame({"id": ["a", "b"] * 3, "b": pd.date_range("2000-01-01", "2000-01-03", freq="9H")})
448-
grouper = pd.Grouper(key='b', freq="D")
449-
g = df.groupby([grouper, 'id'])
447+
df = DataFrame(
448+
{
449+
"id": ["a", "b"] * 3,
450+
"b": date_range("2000-01-01", "2000-01-03", freq="9H"),
451+
}
452+
)
453+
grouper = Grouper(key="b", freq="D")
454+
g = df.groupby([grouper, "id"])
450455

451456
# test number of groups
452-
expected = {(pd.Timestamp("2000-01-01"), 'a'): [0, 2], (pd.Timestamp("2000-01-01"), 'b'): [1],
453-
(pd.Timestamp("2000-01-02"), 'a'): [4], (pd.Timestamp("2000-01-02"), 'b'): [3, 5]}
457+
expected = {
458+
(Timestamp("2000-01-01"), "a"): [0, 2],
459+
(Timestamp("2000-01-01"), "b"): [1],
460+
(Timestamp("2000-01-02"), "a"): [4],
461+
(Timestamp("2000-01-02"), "b"): [3, 5],
462+
}
454463
tm.assert_dict_equal(g.groups, expected)
455464

456465
# test number of group keys

0 commit comments

Comments
 (0)