If I ask pandas to round a datetime to the nearest hour, there is not consistent rounding to the nearest hour from the halfway point. Odd hours like 5 have their half-hour (5:30) rounded up, but even hours have their half hour rounded down. E.g. 5:30 and 6:30 are both rounded to 6.
Why? And how do I get it to do something consistent like round every half-hour up?
>df['nearest_hour']=df['datetime'].dt.round('H')
>df
datetime nearest_hour
141470 2019-10-26 04:45:00+00:00 2019-10-26 05:00:00+00:00
294282 2019-10-26 05:00:00+00:00 2019-10-26 05:00:00+00:00
178460 2019-10-26 05:15:00+00:00 2019-10-26 05:00:00+00:00
92696 2019-10-26 05:30:00+00:00 2019-10-26 06:00:00+00:00
227946 2019-10-26 05:45:00+00:00 2019-10-26 06:00:00+00:00
216924 2019-10-26 06:00:00+00:00 2019-10-26 06:00:00+00:00
167823 2019-10-26 06:15:00+00:00 2019-10-26 06:00:00+00:00
240039 2019-10-26 06:30:00+00:00 2019-10-26 06:00:00+00:00