Pandas - convert strings to time without date

前端 未结 3 2000
感情败类
感情败类 2020-11-27 04:33

I\'ve read loads of SO answers but can\'t find a clear solution.

I have this data in a df called day1 which represents hours:

1    10:53         


        
3条回答
  •  遥遥无期
    2020-11-27 05:24

    You can use to_timedelta

    pd.to_timedelta(df+':00')
    Out[353]: 
    1   10:53:00
    2   12:17:00
    3   14:46:00
    4   16:36:00
    5   18:39:00
    6   20:31:00
    7   22:28:00
    Name: Time, dtype: timedelta64[ns]
    

提交回复
热议问题