-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
CLN/TYPE: window aggregation cleanups and typing #30137
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
Changes from 7 commits
07c00ed
ba95bd6
a73d7b3
32015b2
c79d5c1
e776c67
636166b
259b8b4
674894a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -109,7 +109,7 @@ def _on(self): | |
def is_freq_type(self) -> bool: | ||
return self.win_type == "freq" | ||
|
||
def validate(self): | ||
def validate(self) -> None: | ||
if self.center is not None and not is_bool(self.center): | ||
raise ValueError("center must be a boolean") | ||
if self.min_periods is not None and not is_integer(self.min_periods): | ||
|
@@ -412,7 +412,7 @@ def _get_roll_func(self, func_name: str) -> Callable: | |
) | ||
return window_func | ||
|
||
def _get_cython_func_type(self, func): | ||
def _get_cython_func_type(self, func: str) -> Callable: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If possible to add subtypes to There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Unfortunately the arguments to the cython functions for rolling are still not entirely uniform so the argument list can't be typed consistently. |
||
""" | ||
Return a variable or fixed cython function type. | ||
|
||
|
@@ -517,13 +517,6 @@ def calc(x): | |
center=self.center, | ||
closed=self.closed, | ||
) | ||
if np.any(np.diff(start) < 0) or np.any(np.diff(end) < 0): | ||
# Our "variable" algorithms assume start/end are | ||
# monotonically increasing. A custom window indexer | ||
# can produce a non monotonic start/end. | ||
return func( | ||
x, start, end, min_periods, is_monotonic_bounds=False | ||
) | ||
return func(x, start, end, min_periods) | ||
|
||
else: | ||
|
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.
worth making this an inline helper function (not a big deal though)