Skip to content

Commit 29ce5ac

Browse files
committed
Refactor test to improve readability
1 parent e6d0c79 commit 29ce5ac

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
@@ -1025,9 +1025,7 @@ def test_groupby_transform_with_datetimes(func, values):
10251025
dates = pd.date_range("1/1/2011", periods=10, freq="D")
10261026

10271027
stocks = pd.DataFrame({"price": np.arange(10.0)}, index=dates)
1028-
stocks["week_id"] = (
1029-
pd.to_datetime(stocks.index).isocalendar().set_index(stocks.index).week
1030-
)
1028+
stocks["week_id"] = dates.isocalendar().set_index(dates).week
10311029

10321030
result = stocks.groupby(stocks["week_id"])["price"].transform(func)
10331031

0 commit comments

Comments
 (0)