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

[BUG] Allow numeric_only to be a no-op in certain Series operations #14090

Closed
galipremsagar opened this issue Sep 12, 2023 · 0 comments · Fixed by #14111
Closed

[BUG] Allow numeric_only to be a no-op in certain Series operations #14090

galipremsagar opened this issue Sep 12, 2023 · 0 comments · Fixed by #14111
Assignees
Labels
bug Something isn't working Python Affects Python cuDF API.

Comments

@galipremsagar
Copy link
Contributor

Describe the bug
numeric_only can be ignored as a no-op in certain Series operations based on dtype.

Steps/Code to reproduce bug

In [1]: import pandas as pd

In [2]: s = pd.Series([1, 2, 3])

In [4]: s = pd.Series([1, 2, 3, 10])

In [5]: s.skew()
Out[5]: 1.763632614803888

In [6]: s.skew(numeric_only=True)
Out[6]: 1.763632614803888

In [7]: s.skew(numeric_only=False)
Out[7]: 1.763632614803888

In [8]: import cudf
s =
In [9]: s = cudf.from_pandas(s)
s.
In [10]: s.skew()
Out[10]: 1.763632614803888

In [11]: s.skew(numeric_only=False)
Out[11]: 1.763632614803888

In [12]: s.skew(numeric_only=True)
---------------------------------------------------------------------------
NotImplementedError                       Traceback (most recent call last)
Cell In[12], line 1
----> 1 s.skew(numeric_only=True)

File /nvme/0/pgali/envs/cudfdev/lib/python3.10/site-packages/nvtx/nvtx.py:101, in annotate.__call__.<locals>.inner(*args, **kwargs)
     98 @wraps(func)
     99 def inner(*args, **kwargs):
    100     libnvtx_push_range(self.attributes, self.domain.handle)
--> 101     result = func(*args, **kwargs)
    102     libnvtx_pop_range(self.domain.handle)
    103     return result

File /nvme/0/pgali/envs/cudfdev/lib/python3.10/site-packages/cudf/core/frame.py:2401, in Frame.skew(self, axis, skipna, level, numeric_only, **kwargs)
   2398 if axis not in (0, "index", None, no_default):
   2399     raise NotImplementedError("Only axis=0 is currently supported.")
-> 2401 return self._reduce(
   2402     "skew",
   2403     axis=axis,
   2404     skipna=skipna,
   2405     level=level,
   2406     numeric_only=numeric_only,
   2407     **kwargs,
   2408 )

File /nvme/0/pgali/envs/cudfdev/lib/python3.10/site-packages/nvtx/nvtx.py:101, in annotate.__call__.<locals>.inner(*args, **kwargs)
     98 @wraps(func)
     99 def inner(*args, **kwargs):
    100     libnvtx_push_range(self.attributes, self.domain.handle)
--> 101     result = func(*args, **kwargs)
    102     libnvtx_pop_range(self.domain.handle)
    103     return result

File /nvme/0/pgali/envs/cudfdev/lib/python3.10/site-packages/cudf/core/single_column_frame.py:53, in SingleColumnFrame._reduce(self, op, axis, level, numeric_only, **kwargs)
     50     raise NotImplementedError("level parameter is not implemented yet")
     52 if numeric_only:
---> 53     raise NotImplementedError(
     54         f"Series.{op} does not implement numeric_only"
     55     )
     56 try:
     57     return getattr(self._column, op)(**kwargs)

NotImplementedError: Series.skew does not implement numeric_only

Expected behavior

In [7]: s.skew(numeric_only=False)
Out[7]: 1.763632614803888

Environment overview (please complete the following information)

  • Environment location: [Bare-metal]
  • Method of cuDF install: [from source]
@galipremsagar galipremsagar added bug Something isn't working Python Affects Python cuDF API. labels Sep 12, 2023
@galipremsagar galipremsagar self-assigned this Sep 12, 2023
rapids-bot bot pushed a commit that referenced this issue Sep 14, 2023
…14111)

Fixes: #14090 
This PR allows passing `numeric_only=True` for reduction operation on numerical columns.

Authors:
  - GALI PREM SAGAR (https://github.com/galipremsagar)

Approvers:
  - Matthew Roeschke (https://github.com/mroeschke)

URL: #14111
@github-project-automation github-project-automation bot moved this from In Progress to Done in cuDF/Dask/Numba/UCX Sep 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working Python Affects Python cuDF API.
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

1 participant