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

enh: add maintain_order to Expr.unique and Series.unique #1328

Closed
MarcoGorelli opened this issue Nov 6, 2024 · 3 comments · Fixed by #1333
Closed

enh: add maintain_order to Expr.unique and Series.unique #1328

MarcoGorelli opened this issue Nov 6, 2024 · 3 comments · Fixed by #1333
Labels
enhancement New feature or request high priority Your PR will be reviewed very quickly if you address this

Comments

@MarcoGorelli
Copy link
Member

As requested here plotly/plotly.py#4790 (comment)

We already have maintain_order for DataFrame.unique, my concern is that for some libraries this may turn out to not be guaranteed (and for there to not be any option to guarantee it)

However, a workaround like

token = f'{s.name}_tmp'
s.to_frame().with_row_index(token).unique(col).sort(token).get_column(col)

should always be possible, were some library to stop guaranteeing it

It's not clear to me whether PyArrow makes any guarantees - we can always just use it for now, and if it stop making such guarantees, we use the workaround above apache/arrow#44663

@MarcoGorelli MarcoGorelli added high priority Your PR will be reviewed very quickly if you address this enhancement New feature or request labels Nov 6, 2024
@EdAbati
Copy link
Collaborator

EdAbati commented Nov 6, 2024

To clarify, we just want this option for eager DataFrames/Expr, right?

@MarcoGorelli
Copy link
Member Author

Yes, and for Series

When we get to the lazy-only layer, we should note that this option isn't guaranteed to be available

@raisadz
Copy link
Contributor

raisadz commented Nov 7, 2024

I would like to work on it if that's ok

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request high priority Your PR will be reviewed very quickly if you address this
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants