Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FEA] Series datetime ceil #8682

Closed
beckernick opened this issue Jul 7, 2021 · 1 comment · Fixed by #9141
Closed

[FEA] Series datetime ceil #8682

beckernick opened this issue Jul 7, 2021 · 1 comment · Fixed by #9141
Assignees
Labels
feature request New feature or request libcudf Affects libcudf (C++/CUDA) code. Python Affects Python cuDF API.

Comments

@beckernick
Copy link
Member

As a complement to Series.dt.floor (#7102), I'd like to be able to use call ceil to round the frequency level of the data to a specified frequency (noting that ceil implies "rounding up" to the desired frequency, while floor implies rounding down).

Based on comments in #7102 , this might require libcudf support.

import pandas as pd
import numpy as npnp.random.seed(12)
​
s = pd.Series(pd.date_range('1/1/2018 11:59:00', periods=1000, freq='s')).sample(3)
s
518   2018-01-01 12:07:38
871   2018-01-01 12:13:31
797   2018-01-01 12:12:17
dtype: datetime64[ns]
s.dt.ceil('H') # nearest hour (round up)
518   2018-01-01 13:00:00
871   2018-01-01 13:00:00
797   2018-01-01 13:00:00
dtype: datetime64[ns]
s.dt.ceil('D') # nearest day (round up)
518   2018-01-02
871   2018-01-02
797   2018-01-02
dtype: datetime64[ns]
s.dt.ceil('min') # nearest minute (round up)
518   2018-01-01 12:08:00
871   2018-01-01 12:14:00
797   2018-01-01 12:13:00
dtype: datetime64[ns]
@beckernick beckernick added feature request New feature or request libcudf Affects libcudf (C++/CUDA) code. Python Affects Python cuDF API. Cython labels Jul 7, 2021
@beckernick beckernick added this to the Time Series Analysis milestone Jul 14, 2021
@shaneding shaneding self-assigned this Jul 22, 2021
rapids-bot bot pushed a commit that referenced this issue Aug 25, 2021
Partly addresses #8682 

This adds a `ceil` function for timestamp columns in libcudf. It is applied on fixed resolutions only.

Authors:
  - https://github.com/shaneding

Approvers:
  - Nghia Truong (https://github.com/ttnghia)
  - Vukasin Milovanovic (https://github.com/vuule)

URL: #8942
@beckernick
Copy link
Member Author

With #8942 merged, the next step is Cython bindings for the Python layer. @shaneding should someone else pick that up, as I believe you're doing some Spark plugin work currently?

@rapids-bot rapids-bot bot closed this as completed in #9141 Sep 4, 2021
rapids-bot bot pushed a commit that referenced this issue Sep 4, 2021
Closes #8682. Added python bindings for `ceil` operation implemented in #8942.

Authors:
  - https://github.com/shaneding

Approvers:
  - Ashwin Srinath (https://github.com/shwina)
  - https://github.com/brandon-b-miller

URL: #9141
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request New feature or request libcudf Affects libcudf (C++/CUDA) code. Python Affects Python cuDF API.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants