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

feat(python)!: Update set_sorted to only accept a single column #16800

Merged
merged 2 commits into from
Jun 7, 2024

Conversation

ritchie46
Copy link
Member

@ritchie46 ritchie46 commented Jun 7, 2024

Put clear warnings on every set_sorted def and don't accept multiple columns. If you want to indicate that multiple columns are sorted individually, you'd have to do that manually. This makes it extra clear that the columns are sorted individually.

Example

Before:

>>> df = pl.DataFrame({"a": [1, 2, 3], "b": [4.0, 5.0, 6.0], "c": [9, 7, 8]})
>>> df.set_sorted("a", "b")

After:

>>> df.set_sorted("a", "b")
Traceback (most recent call last):
...
TypeError: DataFrame.set_sorted() takes 2 positional arguments but 3 were given

Use instead:

>>> df.set_sorted("a").set_sorted("b")

@github-actions github-actions bot added breaking Change that breaks backwards compatibility enhancement New feature or an improvement of an existing feature python Related to Python Polars labels Jun 7, 2024
@ritchie46 ritchie46 merged commit 1d2210b into main Jun 7, 2024
12 of 13 checks passed
@ritchie46 ritchie46 deleted the set_sorted branch June 7, 2024 12:14
@c-peters c-peters added the accepted Ready for implementation label Jun 9, 2024
@stinodego stinodego changed the title feat(python)!: Only accept a single column in set_sorted feat(python)!: Update set_sorted to only accept a single column Jun 12, 2024
Wouittone pushed a commit to Wouittone/polars that referenced this pull request Jun 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
accepted Ready for implementation breaking Change that breaks backwards compatibility enhancement New feature or an improvement of an existing feature python Related to Python Polars
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

2 participants