Skip to content

Commit cb30aa2

Browse files
authored
CLN: remove normalize_date, but really this time (#34041)
1 parent f08984e commit cb30aa2

File tree

1 file changed

+0
-31
lines changed

1 file changed

+0
-31
lines changed

pandas/_libs/tslibs/conversion.pyx

-31
Original file line numberDiff line numberDiff line change
@@ -682,37 +682,6 @@ cpdef inline datetime localize_pydatetime(datetime dt, object tz):
682682
# Normalization
683683

684684

685-
def normalize_date(dt: object) -> datetime:
686-
"""
687-
Normalize datetime.datetime value to midnight. Returns datetime.date as a
688-
datetime.datetime at midnight
689-
690-
Parameters
691-
----------
692-
dt : date, datetime, or Timestamp
693-
694-
Returns
695-
-------
696-
normalized : datetime.datetime or Timestamp
697-
698-
Raises
699-
------
700-
TypeError : if input is not datetime.date, datetime.datetime, or Timestamp
701-
"""
702-
if PyDateTime_Check(dt):
703-
if isinstance(dt, _Timestamp):
704-
return dt.replace(hour=0, minute=0, second=0, microsecond=0,
705-
nanosecond=0)
706-
else:
707-
# regular datetime object
708-
return dt.replace(hour=0, minute=0, second=0, microsecond=0)
709-
# TODO: Make sure DST crossing is handled correctly here
710-
elif PyDate_Check(dt):
711-
return datetime(dt.year, dt.month, dt.day)
712-
else:
713-
raise TypeError(f'Unrecognized type: {type(dt)}')
714-
715-
716685
@cython.wraparound(False)
717686
@cython.boundscheck(False)
718687
def normalize_i8_timestamps(int64_t[:] stamps, object tz):

0 commit comments

Comments
 (0)