NVIDIA / NVIDIA/cudf

[FEA] efficient way to truncate by month

Open
#18,650 5 comments 0 reactions 1 assignee Claimed by @ttnghia View on GitHub
feature request good first issue libcudf Python
Dominant language
C++
Stars
9.8k
Forks
1.1k
Avg merge
3d 6m
Merged PRs (30d)
278

Description

Is there an efficient way to truncate a Series by month / quarter in cuDF?

https://docs.rapids.ai/api/cudf/latest/user_guide/api_docs/api/cudf.core.series.datetimeproperties.floor/ dt.floor doesn't support month / year / quarter

In pandas I can either, depending on the dtype backend:
- drop to numpy and use `astype('datetime64["3M"]'))`
- drop to PyArrow and use `pc.floor_temporal`

Any suggestion for cuDF?

Example: given
```python
import cudf
from datetime import datetime

s = cudf.Series([datetime(2020, 2, 4)])
s.dt.truncate('3 months') # Not valid syntax, I know :)
```
I'd like to end up with
```
'2020-01-01'
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.