-
-
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
feat: Add cum_count
expression function
#13478
Conversation
cum_count
expressioncum_count
expression function
Perhaps it could also be a good time to deprecate the pl.cum_count(reverse=True)
pl.cum_count().reverse() ( |
I'm not entirely sure. All While it is technically redundant, otherwise you have to write |
This counts nulls as +1? Seems confusing when
Not sure if |
I don't know what you mean. It functions exactly as you say it does - we made it match import polars as pl
df = pl.DataFrame({"a": [1, 2, 3], "b": [4, None, 6]})
print(df.count())
print(df.select(pl.col("a", "b").cum_count()))
|
Oh, sorry never mind.. I think I got confused by the |
Ref #13473
Ref #12420
When used without arguments, this is basically just syntactic sugar for
int_range(1, count()+1, 1, dtype=IndexDtype)
.I added this to the Rust side as we have no notion of IndexType in Python and I think it's nice to have in Rust anyway.
With arguments it's syntactic sugar for
pl.col(...).cum_count()
. It makes sense to have this along the other 'shortcut' functions we already have.