Group by and count transaction within a period
Source: https://stackoverflow.com/questions/47362530/python-pandas-group-datetimes-by-hour-and-count-row
df.date=pd.to_datetime(df.date)
df.groupby([pd.Grouper(key='date',freq='H'),df.station]).size().reset_index(name='count')
Out[235]:
date station count
0 2017-10-30 15:00:00 A 2
1 2017-10-31 07:00:00 A 1
2 2017-10-31 07:00:00 B 2