'ValueError: time data does not match format '%H:%M:%S.%f' (match)

I have a dataframe with thousand of rows

df_11=

     dataReceived      time     
0       1           15:00:56.052554
1       1           15:02:18.764644
2       1           02:43:10 
3       1           05:46:12
...
6054    1           23:15:14.5687

When i'm trying to convert the column time into date time like this:

pd.to_datetime(df_11['time'], format='%H:%M:%S.%f')

I got the obvious error:

ValueError: time data '02:43:10' does not match format '%H:%M:%S.%f' (match)

Is their a way to easyly append .0 to certains values to fulfill the criteria? I think it's the best thing to do here

I found this similar problem here but i'd like to not use loop when working with dataframe

thx



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source