-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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 rolling_(min/max/sum), rolling_(min/max/sum)_by for pl.Boolean
#19112
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 #19112 +/- ##
=======================================
Coverage 79.65% 79.65%
=======================================
Files 1531 1531
Lines 208937 208956 +19
Branches 2418 2418
=======================================
+ Hits 166421 166442 +21
+ Misses 41969 41967 -2
Partials 547 547 ☔ View full report in Codecov by Sentry. |
let s = self.as_series().clone(); | ||
let mut s = self.as_series().clone(); | ||
if s.dtype().is_bool() { | ||
s = s.cast(&DataType::UInt32)?; |
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.
This should cast to IdxType
.
let s = self.as_series().clone(); | ||
let original_type = self.as_series().dtype(); | ||
let mut s = self.as_series().clone(); | ||
if s.dtype().is_bool() { |
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.
I really don't think we should cast here, but rather have a specialize algorithm for booleans.
ca, | ||
options, | ||
&rolling::no_nulls::rolling_min, | ||
&rolling::nulls::rolling_min, | ||
) | ||
)?; | ||
if original_type.is_bool() { |
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.
I really don't think we should cast here, but rather have a specialize algorithm for booleans.
let mut s = self.as_series().clone(); | ||
if options.weights.is_some() { | ||
s = s.to_float()?; | ||
} else if s.dtype().is_bool() { |
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.
I really don't think we should cast here, but rather have a specialize algorithm for booleans.
On version 1.9.0,
rolling_(min/max/sum)
,rolling_(min/max/sum)_by
operations are not implemented for dtypepl.Boolean
.Before:
After:
Note:
Other
rolling_*
operations, such asrolling_mean
, already support thepl.Boolean
dtype viato_float()
, if I’m not mistaken.