Having Trouble with a DateTime format - need to set first entry then calculate based on time
Now I converted 2 columns that were originally '%H:%M' format toDatetime and it defaulted the Y:M:D to 1900-01-01. How would I be able to name the first row date and then it calculate the date for the rest of the column. I have multiple days in the Actual Time column, so I would need something that adds the next day to the Y:M:D date...
>>> dfsched['Actual Time']= pd.to_datetime(dfsched['Actual Time'], format='%H:%M')
>>> dfsched.head()
Engine Trip Arr/ Dept Schedule Time Actual Time
0 670.0 E9207 D 1900-01-01 06:12:00 1900-01-01 05:49:00
1 670.0 E9207 A 1900-01-01 06:22:00 1900-01-01 06:00:00
2 670.0 9207 D 1900-01-01 06:39:00 1900-01-01 06:39:00
3 670.0 9207 A 1900-01-01 06:43:00 1900-01-01 06:44:00
4 670.0 9207 D 1900-01-01 06:44:00 1900-01-01 06:45:00
So to be clear, I'd like to set row one to "2023-11-12" and for later on in Actual Time's DateTime for it to recognize it's now 2012-11-13 and have it set automatically for the next few days.
Comments
Post a Comment