2022-03-09

Tech Programing

程式人小天地

Python: Get aggregate of minutes for each day

1 min read


I have a dataframe with hour and minute data for each day:

hour minute
00   00
00   01
00   02
00   03
00   04
00   05
...
00   59
01   00
01   01
...

How can I get the aggregate of the minutes column? i.e. the minute of the day rather than the hour. I want the minute column to be continuous t have the following:

hour minute
00   00
00   01
00   02
00   03
00   04
00   05
...
00   59
01   60
01   61
...

How can this be done? (note that my data is pd.datetime and I have already split it into df.dt.hour and df.dt.minute)



Source link

資料來源:Stackoverflow

發佈留言

發佈留言必須填寫的電子郵件地址不會公開。 必填欄位標示為 *