Skip to content

Commit 7441046

Browse files
committed
Revert unintended changes in datetimes.py and test_asfreq.py
1 parent 69ae807 commit 7441046

File tree

2 files changed

+4
-13
lines changed

2 files changed

+4
-13
lines changed

pandas/core/indexes/datetimes.py

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,7 @@
22

33
import datetime as dt
44
import operator
5-
from typing import (
6-
TYPE_CHECKING,
7-
Self,
8-
)
5+
from typing import TYPE_CHECKING
96
import warnings
107

118
import numpy as np
@@ -58,6 +55,7 @@
5855
DtypeObj,
5956
Frequency,
6057
IntervalClosedType,
58+
Self,
6159
TimeAmbiguous,
6260
TimeNonexistent,
6361
npt,
@@ -222,7 +220,6 @@ class DatetimeIndex(DatetimeTimedeltaMixin):
222220
to_pydatetime
223221
to_series
224222
to_frame
225-
to_julian_date
226223
month_name
227224
day_name
228225
mean
@@ -629,13 +626,7 @@ def get_loc(self, key):
629626
def _maybe_cast_slice_bound(self, label, side: str):
630627
# GH#42855 handle date here instead of get_slice_bound
631628
if isinstance(label, dt.date) and not isinstance(label, dt.datetime):
632-
warnings.warn(
633-
"Indexing/slicing with datetime.date is deprecated and will be removed "
634-
"in a future version of pandas. Please convert to pd.Timestamp or "
635-
"datetime64[ns] before indexing.",
636-
FutureWarning,
637-
stacklevel=2,
638-
)
629+
# Pandas supports slicing with dates, treated as datetimes at midnight.
639630
# https://github.com/pandas-dev/pandas/issues/31501
640631
label = Timestamp(label).to_pydatetime()
641632

pandas/tests/frame/methods/test_asfreq.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ def test_asfreq_with_date_object_index(self, frame_or_series):
190190
ts = frame_or_series(np.random.default_rng(2).standard_normal(20), index=rng)
191191

192192
ts2 = ts.copy()
193-
ts2.index = to_datetime([x.date() for x in ts2.index])
193+
ts2.index = [x.date() for x in ts2.index]
194194

195195
result = ts2.asfreq("4h", method="ffill")
196196
expected = ts.asfreq("4h", method="ffill")

0 commit comments

Comments
 (0)