I have a pandas df with Time, Duration (in minutes, integer format), and Duration in timedelta format. The EndTime column has been parsed to time format.
| id | EndTime | Duration_Minutes | Duration_TimeDelta |
|---|---|---|---|
| 1 | 00:53:18 | 120 | 0 days 02:00:00 |
| 2 | 01:04:38 | 35 | 0 days 00:35:00 |
| 3 | 05:04:38 | 5 | 0 days 00:05:00 |
I wanted to created a new column: StartTime
I tried various things: from datetime import timedelta
df['StartTimeEstimate'] = df['EndTime'] - pd.Timedelta(hours=0, minutes=df['Minutes'], seconds=0)
or
df['StartTimeEstimate'] = df['EndTime'] - timedelta(minutes = df['Minutes'])
But couldn't quite work out a StartTime.
Ideally, I would like to see end StartTime to be: 22:53:18 12:29:38 04:59:38
df['Duration_Minutes']?