Skip to content
Advertisement

Convert Hour Minute Second Milisecond to total second.milisecond in latest pandas version

I have csv file with format HH:MM:SS.Milisecond

JavaScript

I want convert that to

JavaScript

How to do that in Pandas latest version (1.4)?

I’ve tried some answers from this forum, but they don’t work on csv and latest version of Pandas.

Advertisement

Answer

Assuming this input:

JavaScript

You can use pandas.Timedelta.total_seconds:

JavaScript

output:

JavaScript
User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement