I am having a really hard time when trying to make a new pandas column in a dataframe that would represent numbered time windows. I am not trying to do grouping/aggregation.
Consider I have following df:
TIME
0 2018-01-02 06:00:00
1 2018-01-02 06:01:56
2 2018-01-02 06:05:55
3 2018-01-02 06:06:08
4 2018-01-02 06:06:22
5 2018-01-02 06:07:16
6 2018-01-02 06:07:57
7 2018-01-02 06:08:42
8 2018-01-02 06:10:44
9 2018-01-02 06:10:24
10 2018-01-02 06:10:46
I need to get the following for a 5 minute window:
TIME WINDOW_NUMBER
0 2018-01-02 06:00:00 1
1 2018-01-02 06:01:56 1
2 2018-01-02 06:05:55 2
3 2018-01-02 06:06:08 2
4 2018-01-02 06:06:22 2
5 2018-01-02 06:07:16 2
6 2018-01-02 06:07:57 2
7 2018-01-02 06:08:42 2
8 2018-01-02 06:10:44 3
9 2018-01-02 06:10:24 3
10 2018-01-02 06:10:46 3
I need the windowing parameter to be adjustable in minutes.
Any help is much appreciated.