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

PanicException: arg_sort operation not supported for dtype struct #8045

Closed
2 tasks done
cmdlineluser opened this issue Apr 7, 2023 · 0 comments · Fixed by #8051
Closed
2 tasks done

PanicException: arg_sort operation not supported for dtype struct #8045

cmdlineluser opened this issue Apr 7, 2023 · 0 comments · Fixed by #8051
Labels
bug Something isn't working python Related to Python Polars

Comments

@cmdlineluser
Copy link
Contributor

cmdlineluser commented Apr 7, 2023

Polars version checks

  • I have checked that this issue has not already been reported.

  • I have confirmed this bug exists on the latest version of Polars.

Issue description

This was fixed for DataFrame.sort in #7777

I just encountered it again trying to use .rank() + .over()

.sort() + .over() also raises the same exception.

.sort() succeeds without .over().

.rank() still raises the exception without .over()

Reproducible example

import polars as pl

df = pl.DataFrame({
   'row_id':[1,2,3,4,5,6,7,8,9,10],
   'Group':[1,1,1,1,1,2,2,2,2,2],
   'Var1':[100,100,100,200,200,300,300,400,400,400],
   'Var2':[5,5,6,7,8,1,1,2,2,3]
})

# PanicException: `arg_sort` operation not supported for dtype `struct[2]`
df.with_columns(pl.struct("Var1", "Var2").rank().over("Group"))

# PanicException: `arg_sort` operation not supported for dtype `struct[2]`
df.with_columns(pl.struct("Var1", "Var2").sort().over("Group"))

# PanicException: `arg_sort` operation not supported for dtype `struct[2]`
df.with_columns(pl.struct("Var1", "Var2").rank())

# OK
df.with_columns(pl.struct("Var1", "Var2").sort())

Expected behavior

No exception.

Installed versions

---Version info---
Polars: 0.16.18
Index type: UInt32
Python: 3.10.9 (main, Jan 14 2023, 16:56:26)
---Optional dependencies---
numpy: 1.23.5
pandas: 2.0.0
pyarrow: 9.0.0
connectorx: <not installed>
deltalake: <not installed>
fsspec: 2022.8.2
matplotlib: 3.5.1
xlsx2csv: 0.8
xlsxwriter: 3.0.8
@cmdlineluser cmdlineluser added bug Something isn't working python Related to Python Polars labels Apr 7, 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 Related to Python Polars
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant