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

[FEA] Python bindings for lists::sort #7467

Closed
shwina opened this issue Feb 26, 2021 · 2 comments · Fixed by #7657
Closed

[FEA] Python bindings for lists::sort #7467

shwina opened this issue Feb 26, 2021 · 2 comments · Fixed by #7657
Assignees
Labels
feature request New feature or request Python Affects Python cuDF API.

Comments

@shwina
Copy link
Contributor

shwina commented Feb 26, 2021

#7122 introduces a lists::sort_lists API that we should plumb through to Python. The Python API we want is probably something like:

>>> s = cudf.Series([[4, 2, None, 9], [8, 8, 2], [2, 1]])
>>> s.list.sort(ascending=True, na_position="last")  # returns Series([[2, 4, 9, None], [2, 8, 8], [1, 2]])
@shwina shwina added feature request New feature or request Needs Triage Need team to review and classify labels Feb 26, 2021
@shwina shwina added Python Affects Python cuDF API. Cython and removed Needs Triage Need team to review and classify labels Feb 27, 2021
@ttnghia
Copy link
Contributor

ttnghia commented Mar 12, 2021

Maybe a related API to this can also be working together: Python binding for drop_list_duplicates (#7414)

@kkraus14
Copy link
Collaborator

Should make this Series.list.sort_values to match the Series level API

rapids-bot bot pushed a commit that referenced this issue Mar 24, 2021
Closes #7467 

Introduces list method `list.sort_values`. Sorts each list of a LIST column based on given criterion. This method signature is aligned with `Series.sort_values`. Example:

```python
>>> s = cudf.Series([[4, 2, None, 9], [8, 8, 2], [2, 1]])
>>> s.list.sort_values(ascending=False, na_position="last")
0    [nan, 9.0, 4.0, 2.0]
1         [8.0, 8.0, 2.0]
2              [2.0, 1.0]
dtype: list
```

This PR also includes exposing `ListMethods` to docs and a small docstring fix to `cudf.Series`.

Authors:
  - Michael Wang (@isVoid)

Approvers:
  - GALI PREM SAGAR (@galipremsagar)
  - Keith Kraus (@kkraus14)

URL: #7657
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request New feature or request Python Affects Python cuDF API.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants