Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

truncate date to midnight in pandas column

df['START_DATETIME'] = pd.to_datetime(df['START_DATETIME']).dt.normalize()
# -or-
df['START_DATETIME'] = pd.to_datetime(df['START_DATETIME']).dt.floor('D')
 
PREVIOUS NEXT
Tagged: #truncate #date #midnight #pandas #column
ADD COMMENT
Topic
Name
9+4 =