Splitting timestamp column into separate date and time columns

后端 未结 7 775
执念已碎
执念已碎 2020-11-27 06:29

I have a pandas dataframe with over 1000 timestamps (below) that I would like to loop through:

2016-02-22 14:59:44.561776

I\'m having a har

7条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-11-27 06:58

    Try

    s = '2016-02-22 14:59:44.561776'
    
    date,time = s.split()
    

    then convert time as needed.

    If you want to further split the time,

    hour, minute, second = time.split(':')
    

提交回复
热议问题