narwhals-dev / narwhals

Lightweight and extensible compatibility layer between dataframe libraries!
https://narwhals-dev.github.io/narwhals/
MIT License
611 stars 91 forks source link

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

Closed FBruzzesi closed 1 week ago

FBruzzesi commented 1 week ago

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

Related issues

Checklist

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

FBruzzesi commented 1 week ago

Pyarrow introduced cumulative_min, cumulative_max and cumulative_prod in 13.0

AlessandroMiola commented 1 week ago

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 commented 1 week ago

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 commented 1 week ago

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 ✌️