-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
next()
on GroupBy raises AttributeError
object has no attribute _current_index
#12868
Comments
https://github.com/pola-rs/polars/blob/main/py-polars/polars/dataframe/group_by.py "just" needs this treatment |
Yeah, the machinery is there I think.
polars/py-polars/polars/dataframe/group_by.py Line 114 in e9a95b7
So it works if you manually call df = pl.DataFrame({"a": [1, 1, 2], "b": [3, 4, 5]})
next(iter(df.group_by("a")))
# (1,
# shape: (2, 2)
# ┌─────┬─────┐
# │ a ┆ b │
# │ --- ┆ --- │
# │ i64 ┆ i64 │
# ╞═════╪═════╡
# │ 1 ┆ 3 │
# │ 1 ┆ 4 │
# └─────┴─────┘) |
I think it needs to be in |
I can try to fix it |
This should raise a TypeError. |
Instead of the try-except proposed, we should return an object of a new class |
Checks
I have checked that this issue has not already been reported.
I have confirmed this bug exists on the latest version of Polars.
Reproducible example
Log output
No response
Issue description
Not sure if
next()
is intended to work or not, it seems like it should raise a TypeError instead if it isn't.Expected behavior
"Work" or return a TypeError?
Installed versions
The text was updated successfully, but these errors were encountered: