Skip to content

Commit 0bda2e8

Browse files
committed
Refactor test to improve readability
1 parent 56874ec commit 0bda2e8

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

pandas/tests/groupby/transform/test_transform.py

+1-3
Original file line numberDiff line numberDiff line change
@@ -1022,9 +1022,7 @@ def test_groupby_transform_with_datetimes(func, values):
10221022
dates = pd.date_range("1/1/2011", periods=10, freq="D")
10231023

10241024
stocks = pd.DataFrame({"price": np.arange(10.0)}, index=dates)
1025-
stocks["week_id"] = (
1026-
pd.to_datetime(stocks.index).isocalendar().set_index(stocks.index).week
1027-
)
1025+
stocks["week_id"] = dates.isocalendar().set_index(dates).week
10281026

10291027
result = stocks.groupby(stocks["week_id"])["price"].transform(func)
10301028

0 commit comments

Comments
 (0)