-
-
Notifications
You must be signed in to change notification settings - Fork 2k
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
fix(python): Fix next
on group by objects throw TypeError
#19615
base: main
Are you sure you want to change the base?
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #19615 +/- ##
=======================================
Coverage 79.96% 79.97%
=======================================
Files 1536 1536
Lines 211374 211389 +15
Branches 2445 2445
=======================================
+ Hits 169034 169052 +18
+ Misses 41785 41782 -3
Partials 555 555 ☔ View full report in Codecov by Sentry. |
@@ -111,7 +111,13 @@ def __iter__(self) -> Self: | |||
return self | |||
|
|||
def __next__(self) -> tuple[tuple[object, ...], DataFrame]: | |||
if self._current_index >= len(self._group_indices): | |||
try: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of this try-except, we should return an object of a new class on __iter__
. Then it is solved by the type system.
…ice or with streaming collect (pola-rs#19609)
…offsetting by non-constant durations in the timezone-naive case (pola-rs#19616)
…la-rs#19588) Co-authored-by: siddharthv <[email protected]>
…e "$" character with reference to capture groups (vs use as a literal) (pola-rs#19529)
…olumn name matches upper column name (pola-rs#19638)
…la-rs#19667) Co-authored-by: Max Tilley <[email protected]>
…s#19620) Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Stijn de Gooijer <[email protected]>
pola-rs#19687) Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
…`, `removesuffix`, and `zfill` in `map_elements` (pola-rs#19672)
…s on `DataFrame` (pola-rs#19683)
In #12868 , a direct call to the next method on a group by object raises an unintended AttributeError. In my pr, this raises a TypeError. For my fix, I caught the line throwing the error and re-raised it as a TypeError, since the line indicates the iter method has not been called yet. This fix feels a bit imperfect, and I'm not thrilled the try-except is performed every time the next method is called.
Pretty new to open source, so apologies if things are out of sorts. Thank you!