resample
от pandas
должно соответствовать вашему случаю
import pandas as pd
df = pd.DataFrame({
'Date':['2016-01-01 07:00:00','2016-01-01 07:05:00',
'2016-01-01 07:17:00' ,'2016-01-01 08:13:00',
'2016-01-01 08:55:00','2016-12-31 22:00:00',
'2016-12-31 22:05:00','2016-12-31 23:13:00',
'2016-12-31 23:33:00','2016-12-31 23:53:00'],
'Col1':[1, 2, 3, 2, 10, 3, 3, 4, 5, 6]
})
df['Date'] = pd.to_datetime(df['Date'], format='%Y-%m-%d') # Convert series to datetime type
df.set_index('Date', inplace=True) # Set Date column as index
# for every hour, take the mean for the remaining columns of the dataframe
# (in this case only for Col1, fill the NaN with 0 and reset the index)
df.resample('H').mean().fillna(0).reset_index()
df.head()
Date Col1
0 2016-01-01 07:00:00 2.0
1 2016-01-01 08:00:00 6.0
2 2016-01-01 09:00:00 0.0
3 2016-01-01 10:00:00 0.0
4 2016-01-01 11:00:00 0.0