Confusion about change from pl.count()
to pl.len()
#14498
Labels
documentation
Improvements or additions to documentation
pl.count()
to pl.len()
#14498
Description
The upgrade guide indicates that:
But based on my testing:
pl.count()
andExpr.count()
now behave the same way, ignoring nulls. This behavior is also mentioned in the API reference ofpl.count()
, which states, "This function is syntactic sugar for col(columns).count()."group_by().agg(pl.count())
is getting a "DeprecationWarning:pl.count()
is deprecated. Please usepl.len()
instead."Meanwhile, I don't know why we can use
group_by().agg(pl.count())
as @mcrumiller mentioned here. This seems counterintuitive to me. The usage of bothpl.len()
andpl.count()
creates inconsistency and confusions. Instead of having two separate functions/expressions, why not have a single function/expr with an arg toignore_nulls
?Link
https://docs.pola.rs/releases/upgrade/0.20/#count-now-ignores-null-values
The text was updated successfully, but these errors were encountered: