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

Add pandas compatible output to Series.unique #13959

Merged
merged 1 commit into from
Aug 25, 2023

Conversation

galipremsagar
Copy link
Contributor

Description

Partially addresses #8175
This PR makes changes to Series.unique, where a cupy array is returned to match pd.Series.unique where a numpy array is returned.

Checklist

  • I am familiar with the Contributing Guidelines.
  • New or existing tests cover these changes.
  • The documentation is up to date with these changes.

@galipremsagar galipremsagar added 3 - Ready for Review Ready for review by team Python Affects Python cuDF API. 4 - Needs cuDF (Python) Reviewer labels Aug 25, 2023
@galipremsagar galipremsagar requested a review from a team as a code owner August 25, 2023 00:57
@galipremsagar galipremsagar self-assigned this Aug 25, 2023
Copy link
Contributor

@wence- wence- left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this makes sense.

@@ -2970,6 +2970,8 @@ def unique(self):
dtype: object
"""
res = self._column.unique()
if cudf.get_option("mode.pandas_compatible"):
return res.values
return Series(res, name=self.name)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only doing this in pandas-compat mode because this marks the buffer as exposed, and may not work for string/struct types?

Copy link
Contributor Author

@galipremsagar galipremsagar Aug 25, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yup, will only work for numeric types (int, float..) and error for the rest of the types.

@galipremsagar galipremsagar added improvement Improvement / enhancement to an existing function non-breaking Non-breaking change 5 - Ready to Merge Testing and reviews complete, ready to merge and removed 3 - Ready for Review Ready for review by team 4 - Needs cuDF (Python) Reviewer labels Aug 25, 2023
@galipremsagar
Copy link
Contributor Author

/merge

@rapids-bot rapids-bot bot merged commit aef903c into rapidsai:branch-23.10 Aug 25, 2023
55 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
5 - Ready to Merge Testing and reviews complete, ready to merge improvement Improvement / enhancement to an existing function non-breaking Non-breaking change Python Affects Python cuDF API.
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

2 participants