NVIDIA / NVIDIA/cudf

[FEA] Handle selected functions that don't have bytecode in `Series.apply`

Open
#11,595 3 comments 0 reactions 0 assignees View on GitHub
feature request numba Python
Dominant language
C++
Stars
9.8k
Forks
1.1k
Avg merge
3d 6m
Merged PRs (30d)
278

Description

**Is your feature request related to a problem? Please describe.**
During discussion in https://github.com/rapidsai/cudf/pull/11578 we realized that users might try and pass several commonly used python functions that don't necessarily have bytecode directly to `Series.apply`. For instance, using `float` dispatches to a C-level `__init__` method and thus has no bytecode for numba to build a function out of.

**Describe the solution you'd like**
It would be nice if this worked:
```python
cudf.Series([1,2,3]).apply(float)
# [1.0, 2.0, 3.0]
```
We should be able to use
- int
- float
- bool

We could also add:
- Numpy dtypes
- string?

**Describe alternatives you've considered**
Users should just call `astype` but this seems like plausible usage.

**Additional context**
Came up during https://github.com/rapidsai/cudf/pull/11578#pullrequestreview-1082926062

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.