Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

how to separate date and time in python

import pandas as pd
df = pd.DataFrame({'datetime':pd.date_range('2020-01-01 07:10',periods=6)})
print("DataFrame is:
", df)
df['date'] = pd.to_datetime(df['datetime']).dt.date
df['time'] = pd.to_datetime(df['datetime']).dt.time
print("Date-time-hour-minutes :
", df)
Source by www.tutorialspoint.com #
 
PREVIOUS NEXT
Tagged: #separate #date #time #python
ADD COMMENT
Topic
Name
4+3 =