NVIDIA / NVIDIA/cudf

[BUG] Series.clip does not work with numpy/cupy clip

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

Description

**Describe the bug**
rewriting code with `import cudf as pd`

**Steps/Code to reproduce bug**
```
>>> import cudf as pd
>>> import cupy as np
>>> pd.__version__
'22.12.01'
>>> np.__version__
'11.4.0'

>>> df = pd.DataFrame({'a': range(10, 30)})

>>> np.clip(df.to_pandas().a, a_min=15, a_max=25)
0 15
1 15
2 15
3 15
4 15
5 15
6 16
7 17
8 18
9 19
10 20
11 21
12 22
13 23
14 24
15 25
16 25
17 25
18 25
19 25
Name: a, dtype: int64

>>> np.clip(df.a, a_min=15, a_max=25)
Traceback (most recent call last):
File "", line 1, in
File ".../python3.8/site-packages/cupy/_math/misc.py", line 172, in clip
return a.clip(a_min, a_max, out=out)
File ".../python3.8/contextlib.py", line 75, in inner
return func(*args, **kwds)
TypeError: clip() got an unexpected keyword argument 'out'
```

**Additional context**
https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.Series.clip.html
```
*args, **kwargs
Additional keywords have no effect but might be accepted for compatibility with numpy.
```

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.