Skip to content

pd.Series.dt.round

pandas.Series.dt.round(freq, ambiguous='raise', nonexistent='raise')

Supported Arguments

argument datatypes other requirements
freq String Must be a valid fixedfrequency alias

Example Usage

>>> @bodo.jit
... def f(S):
...     return S.dt.round("H")
>>> S = pd.Series(pd.date_range(start='1/1/2022', end='1/10/2022', periods=30))
>>> f(S)
0    2022-01-01 00:00:00
1    2022-01-01 07:00:00
2    2022-01-01 15:00:00
3    2022-01-01 22:00:00
4    2022-01-02 06:00:00
5    2022-01-02 13:00:00
6    2022-01-02 21:00:00
7    2022-01-03 04:00:00
8    2022-01-03 12:00:00
9    2022-01-03 19:00:00
10   2022-01-04 02:00:00
11   2022-01-04 10:00:00
12   2022-01-04 17:00:00
13   2022-01-05 01:00:00
14   2022-01-05 08:00:00
15   2022-01-05 16:00:00
16   2022-01-05 23:00:00
17   2022-01-06 07:00:00
18   2022-01-06 14:00:00
19   2022-01-06 22:00:00
20   2022-01-07 05:00:00
21   2022-01-07 12:00:00
22   2022-01-07 20:00:00
23   2022-01-08 03:00:00
24   2022-01-08 11:00:00
25   2022-01-08 18:00:00
26   2022-01-09 02:00:00
27   2022-01-09 09:00:00
28   2022-01-09 17:00:00
29   2022-01-10 00:00:00
dtype: datetime64[ns]