I have a pandas datetime column and I need to convert to required format.
0 2017-09-27 07:54:20
1 2017-09-27 08:24:04
2 2017-09-27 09:02:06
3 2017-09-27 09:04:14
4 2017-09-27 09:04:18
0 2017-09-27T07:54:20
1 2017-09-27T08:24:04
2 2017-09-27T09:02:06
3 2017-09-27T09:04:14
4 2017-09-27T09:04:18
I have split the column in to two ,add 'T' value and merged together. Is there any efficient way to do this?
Using dt.strftime
#df.date=pd.to_datetime(df.date)
df.date=df.date.dt.strftime('%Y-%m-%dT%H:%M:%S')
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.