I have a Pandas DataFrame as below
ReviewID ID Type TimeReviewed
205 76032930 51936827 ReportID 2015-01-15 00:05:27.513000
232 76032930 51936854 ReportID 2015-01-15 00:06:46.703000
233 76032930 51936855 ReportID 2015-01-15 00:06:56.707000
413 76032930 51937035 ReportID 2015-01-15 00:14:24.957000
565 76032930 51937188 ReportID 2015-01-15 00:23:07.220000
>>> type(df)
<class 'pandas.core.frame.DataFrame'>
TimeReviewed is a series type
>>> type(df.TimeReviewed)
<class 'pandas.core.series.Series'>
I've tried below, but it still doesn't change the Series type
import pandas as pd
review = pd.to_datetime(pd.Series(df.TimeReviewed))
>>> type(review)
<class 'pandas.core.series.Series'>
How can I change the df.TimeReviewed to DateTime type and pull out year, month, day, hour, min, sec separately?
I'm kinda new to python, thanks for your help.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…