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

feat: add Series|Expr cum_min and cum_max methods #1384

Merged
merged 5 commits into from
Nov 16, 2024
Merged

Conversation

FBruzzesi
Copy link
Member

What type of PR is this? (check all applicable)

  • 💾 Refactor
  • ✨ Feature
  • 🐛 Bug Fix
  • 🔧 Optimization
  • 📝 Documentation
  • ✅ Test
  • 🐳 Other

Related issues

Checklist

  • Code follows style guide (ruff)
  • Tests added
  • Documented the changes

If you have comments or can explain your changes, please do so below

@github-actions github-actions bot added the enhancement New feature or request label Nov 15, 2024
Comment on lines +833 to +834
else pc.cumulative_min(native_series[::-1], skip_nulls=True)[::-1]
)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Both this and pandas needs to reverse twice. Is there any other option?

@FBruzzesi
Copy link
Member Author

Pyarrow introduced cumulative_min, cumulative_max and cumulative_prod in 13.0

@AlessandroMiola
Copy link
Contributor

AlessandroMiola commented Nov 15, 2024

Pyarrow introduced cumulative_min, cumulative_max and cumulative_prod in 13.0

Not sure if relevant, should we maybe also re-map these into their polars native exprs via POLARS_TO_ARROW_AGGREGATIONS for use in group_by like exprs? Found this might be relevant on #1177.

@FBruzzesi
Copy link
Member Author

FBruzzesi commented Nov 15, 2024

Pyarrow introduced cumulative_min, cumulative_max and cumulative_prod in 13.0

Not sure if relevant, should we maybe also re-map these into their polars native exprs via POLARS_TO_ARROW_AGGREGATIONS for use in group_by like exprs? Found this might be relevant on #1177.

That's a very good point. However for arrow this is not possible, unless we move operations unsupported natively to use __iter__, but that would most likely be slow (List of pyarrow grouped aggregations).

Regarding pandas, I will check that's possible to achieve and add tests. However I am a bit hesitant due to the impossibility of passing arguments along (reverse=True)

@AlessandroMiola
Copy link
Contributor

That's a very good point. However for arrow this is not possible, unless we move operations unsupported natively to use __iter__, but that would most likely be slow (List of pyarrow grouped aggregations).

ahhh, right, I see ✌️

@FBruzzesi FBruzzesi changed the title feat: add Series|Expr.cum_min method feat: add Series|Expr cum_min and cum_max methods Nov 16, 2024
@FBruzzesi FBruzzesi mentioned this pull request Nov 16, 2024
5 tasks
Copy link
Member

@MarcoGorelli MarcoGorelli left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

awesome, thanks @FBruzzesi !

@MarcoGorelli MarcoGorelli merged commit 8ed6e7e into main Nov 16, 2024
24 checks passed
@FBruzzesi FBruzzesi deleted the feat/cum-min branch November 16, 2024 10:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants