df.set_index('TIME').groupby(pd.TimeGrouper('180M'))
or grouped = df.groupby(lambda x: x.hour)
i am using this code to divide my time column into groups of 3 hours each. 11pm to 2am ,2am to 5am and so on This method is not yielding the result i want
ID | TIME | SMS | CALL | INTERNET
1 | 2013-11-30 23:00:00 | 0.277204 | 0.273629 | 13.674575 1 | 2013-11-30 23:10:00 | 0.341536 | 0.058176 | 13.330858 1 | 2013-11-30 23:20:00 | 0.379427 | 0.054601 | 11.329552 ID | TIME | SMS | CALL | INTERNET
1 | 2013-11-30 23:00:00 | 0.277204 | 0.273629 | 13.674575 1 | 2013-11-30 23:10:00 | 0.341536 | 0.058176 | 13.330858 1 | 2013-11-30 23:20:00 | 0.379427 | 0.054601 | 11.329552 1 | 2013-11-30 23:30:00 | 0.600781 | 0.218489 | 13.166163 1 | 2013-11-30 23:40:00 | 0.405565 | 0.134176 | 13.347791 1 | 2013-11-30 23:50:00 | 0.187700 | 0.080738 | 12.434744 . . . . 9999 | 2013-12-01 22:30:00 | 1.060817 | 0.897322 | 23.553619 9999 | 2013-12-01 22:40:00 | 0.807689 | 0.645058 | 26.126893 9999 | 2013-12-01 22:50:00 | 0.260757 | 0.281170 | 22.386004
Expected Output
Preferable output:
Group1 ID | TIME | SMS | CALL | INTERNET
1 | 2013-11-30 23:00:00 | 0.277204 | 0.273629 | 13.674575
1 | 2013-11-30 23:10:00 | 0.341536 | 0.058176 | 13.330858
1 | 2013-11-30 23:20:00 | 0.379427 | 0.054601 | 11.329552
1 | . . .. . 02:00:00| (values) |(values) | (Values)
9999 | . . .. . 02:00:00| (values) |(values) | (Values)
Group2 1 | 2013-11-30 02:00:00 | 0.277204 | 0.273629 | 13.674575
1 | 2013-11-30 02:10:00 | 0.341536 | 0.058176 | 13.330858
1 | 2013-11-30 02:20:00 | 0.379427 | 0.054601 | 11.329552
1 | . . .. . 05:00:00| (values) |(values) | (Values)
9999 | . . .. . 05:00:00| (values) |(values) | (Values)
Comment From: shruti1105
@jreback
Comment From: shruti1105
@wesm
Comment From: shruti1105
#19192
Comment From: jreback
you already have an issue for this ? is this a different question? pls ask usage questions on stack overflow
Comment From: shruti1105
Yes I do .and I’m unable to solve it. No response on stack overflow
Comment From: jreback
this is a usage question w/o a copy pastable example no one is likely to be able to help you need to ask a precise question on SO with a fully copy pastable example