excelpandasdatetimeelapsedtime

Covert Elapsed time to datetime


I have an excel file that contains the start date: 24/09/2021, start time: 16:13:48, The Test Length [D:H:M]: 06:17:25.

The data are saved for PM in Elapsed time after the start time every 5 minutes. enter image description here

I would like to convert this Elapsed time to DateTime(24/09/2021 16:18:00), considering the start time and start date either in pandas or Excel for the whole test duration as below

enter image description here

Any help would be appreciated.


Solution

  • Use to_datetime with origin and unit parameters:

    df['Elapsed Time [s]'] = pd.to_datetime(df['Elapsed Time [s]'],
                                            origin='24/09/2021 16:13:48',
                                            unit='s')