-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
.over()
fails with .get
.
#18191
Comments
df.select(
pl.col("name")
.sort_by("age")
.implode()
.over("country", mapping_strategy="explode")
.list.get(0)
)
# shape: (3, 1)
# ┌──────┐
# │ name │
# │ --- │
# │ str │
# ╞══════╡
# │ a │
# │ c │
# │ f │
# └──────┘ Not sure what is happening with df.select(
pl.col("name")
.sort_by("age")
.implode()
.get(0)
.over("country", mapping_strategy="explode")
)
# OutOfBoundsError: gather indices are out of bounds Perhaps it's supposed to raise the |
@cmdlineluser I would like to ask why In addition, for : df.select(
pl.col("name")
.sort_by("age")
.implode()
.over("country", mapping_strategy="explode")
.list.get(0)
) , isn't this exactly |
The reason you can't do The reason you can do What are you expecting for the output of
Is it something different from what this gives?
If I'm misunderstanding what you're trying to do I'm happy to reopen but for now I'm going to close. |
The difference is that only the |
Ahhh I see. Try doing
Incidentally, you might want to follow this |
Thank you! But I found that I abused Used the df.group_by("country").agg(
pl.col("name").sort_by("age").slice(2, 1).first()
) |
Checks
Reproducible example
Log output
InvalidOperationError: 'implode' followed by an aggregation is not allowed.
Issue description
It seems that the
.over
method cannot be used with the.get
method.I also tried the code below
Error:
OutOfBoundsError: gather indices are out of bounds.
Expected behavior
I don’t understand what the above two error reports refer to and what are their reasons.
I know that this operation logic can be replaced by the
group_by
method. What I want to know more is what is the underlying reason for the error and whether this is an unexpected bug.Installed versions
The text was updated successfully, but these errors were encountered: