Skip to content
Advertisement

Tag: datetime

Pandas dataframe diff between rows with column offset

I have a Dataframe with the following structure time_start time_end label time time + 1 action time + 1 time + 2 some_other_action I would like to take see the diff of time_start and previous row time_end. in this case (time + 1) – (time + 1) = 0 I have tried df.diff, but that only yields the diff within

How to convert a 3 digit number to Minute-Second format

In my basketball sim, the quarter clock is set to a 3 digit number, 12 minute quarters * 60 seconds = 720 seconds. After the result of my play, I subtract a random number, in-between 10-24, from the quarter clock. I print the result of my play, as well as the quarter clock. Example code: output: How can I make

Advertisement