Python/Pandas convert string to time only

后端 未结 4 504
伪装坚强ぢ
伪装坚强ぢ 2020-12-02 20:38

I have the following Pandas dataframe in Python 2.7.

import pandas as pd
trial_num = [1,2,3,4,5]
sail_rem_time = [\'11:33:11\',\'16:29:05\',\'09:37:56\',\'21         


        
4条回答
  •  天命终不由人
    2020-12-02 21:20

    Using to_timedelta,we can convert string to time format(timedelta64[ns]) by specifying units as second,min etc.,

    dfc['Time_of_Sail'] = pd.to_timedelta(dfc['Time_of_Sail'], unit='s')
    

提交回复
热议问题