Python/Pandas convert string to time only

These two lines:

dfc['Time_of_Sail'] = pd.to_datetime(dfc['Time_of_Sail'])
dfc['Time_of_Sail'] = [time.time() for time in dfc['Time_of_Sail']]

Can be written as:

dfc['Time_of_Sail'] = pd.to_datetime(dfc['Time_of_Sail'],format="%H:%M:%S" ).dt.time

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)