[FEA] Support `cut` and `qcut` in cudf-polars
- Dominant language
- C++
- Stars
- 9.8k
- Forks
- 1.1k
- Avg merge
- 3d 6m
- Merged PRs (30d)
- 278
Description
```python
import polars as pl
pl.Config.set_verbose(True)
ser = pl.Series('foo', [-2, -1, 0, 1, 2])
# cut
print(
pl.LazyFrame(ser)
.with_columns(pl.col("foo").cut([-1, 1], labels=["a", "b", "c"]).alias("cut"))
.collect(engine='gpu')
)
"""
/opt/miniconda3_py312/lib/python3.12/site-packages/polars/lazyframe/frame.py:2407: PerformanceWarning: Query execution with GPU not possible: unsupported operations.
The errors were:
- NotImplementedError: dtype=Categorical conversion not supported
return wrap_df(ldf.collect(engine, callback))
shape: (5, 2)
┌─────┬─────┐
│ foo ┆ cut │
│ --- ┆ --- │
│ i64 ┆ cat │
╞═════╪═════╡
│ -2 ┆ a │
│ -1 ┆ a │
│ 0 ┆ b │
│ 1 ┆ b │
│ 2 ┆ c │
└─────┴─────┘
"""
# qcut
print(
pl.LazyFrame(ser)
.with_columns(pl.col("foo").qcut([0.25, 0.75], labels=["a", "b", "c"]).alias("qcut"))
.collect(engine='gpu')
)
"""
/opt/miniconda3_py312/lib/python3.12/site-packages/polars/lazyframe/frame.py:2407: PerformanceWarning: Query execution with GPU not possible: unsupported operations.
The errors were:
- NotImplementedError: dtype=Categorical conversion not supported
return wrap_df(ldf.collect(engine, callback))
shape: (5, 2)
┌─────┬──────┐
│ foo ┆ qcut │
│ --- ┆ --- │
│ i64 ┆ cat │
╞═════╪══════╡
│ -2 ┆ a │
│ -1 ┆ a │
│ 0 ┆ b │
│ 1 ┆ b │
│ 2 ┆ c │
└─────┴──────┘
"""
```
The cudf-polars version is '25.12.00a350'
Contributor guide
Assessment
This issue has not been assessed yet.