Python time processing: know the start time and end time, count the number of times per minute

know the start time and end time of each sample, as shown in the following figure:

hu is the unique value of the sample. It is known that time1 and time2 are the start time and end time of the behavior, respectively. Now, we want to count the number of behaviors per minute, such as the number of sample behaviors per minute, such as 1815, 2200, 18, 22, 59, and so on. A total of 24,60,1440 minutes throughout the day.
for example, in line 8, 41000007 magnum timekeeping 15015 freestanding 15freel00000505140511459, then even if he acts at 15:50, he also acts at 15:51, and so on, until 15:59.
all times have been converted to HH:mm:00 and HH:mm: 59 points

now there are two immature ideas, you can refer to:
the first is to start the cycle from the first minute of the day to determine whether time1 < I < time2, then record + 1;
the second cycle of each sample to determine the number of minutes in which his behavior took place, and then recorded.

do you have a better solution?

May.19,2022

use dictionary statistics
key: yyyy-mm-dd HH:MM
value: times


it is recommended to set the hu field, and then calculate the length of time in minutes, and add 1 to the number of times. So that the function can be done with excel or with sql.

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e8dbe0-1180.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e8dbe0-1180.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?