I have a CSV file whose first column looks like this:
2018-12-10 20:00:25.855
2018-12-10 20:09:26
2018-12-10 20:13:27.31
2018-12-10 20:23:28
These are currently strings that I want to ultimately convert into just time objects (without the date). My first step was to remove the milliseconds but I can't figure out how to do that when some of the strings don't contain milliseconds.
I tried using this line to replace the milliseconds value but I end up with "data remains" error.
strdate = datetime.strptime(column[0], '%Y-%m-%d %H:%M:%S').replace(microsecond=0)
ValueError: unconverted data remains: .855
I have also tried stripping the string after the "." but nothing happens.
column[0].strip('.')