Time volts
0 15:15:10.951 368
1 15:15:11.950 373
2 15:15:12.950 368
3 15:15:13.949 316
4 15:15:14.949 368
... ... ...
2141 15:50:54.087 337
2142 15:50:55.069 343
2143 15:50:56.085 344
2144 15:50:57.081 339
2145 15:50:58.090 347
def time_convert(x):
h,m,s = map(int,x.split(':'))
return int(h) * 3600 + int(m) * 60 + int(s)
The output I get:
ValueError Traceback (most recent call last)
<ipython-input-17-68cf4416cc88> in <module>
----> 1 df['Time'] = df['Time'].apply(time_convert)
4 frames
<ipython-input-12-42bee45f8bd8> in time_convert(x)
1 def time_convert(x):
----> 2 h,m,s = map(int,x.split(':'))
3 return int(h) * 3600 + int(m) * 60 + int(s)
4
5
ValueError: invalid literal for int() with base 10: '10.951'
I was expecting it to be converted to seconds. I only find HH:MM:SS format to seconds for solutions but I have not found any cases regarding SS.SS conversion.