Skip to content

Conversation

@mroeschke
Copy link
Member

  • tests added / passed
  • passes black pandas
  • passes git diff upstream/master -u -- "*.py" | flake8 --diff

Cleans helper functions in rolling.py and remove dead code paths.

@mroeschke mroeschke added Clean Window rolling, ewma, expanding labels Jan 4, 2020

# coerce if necessary
if block is not None:
if is_timedelta64_dtype(block.values.dtype):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this not reachable?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't think so. Our test suite includes timedelta64 which doesn't his this branch.

@jbrockmendel
Copy link
Member

Nice cleanup

@jreback jreback added this to the 1.0 milestone Jan 4, 2020


def _offset(window, center):
def _calculate_center_offset(window):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

as a followup typing & doc-strings would be great. also ok to de-privatize these

def func(arg, window, min_periods=None, closed=None):
minp = check_minp(min_periods, len(window))
return cfunc(arg, window, minp, **kwargs)
@staticmethod
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

instead of static can you make this a module level function, or is there a reason you want this as static?

Copy link
Member

@WillAyd WillAyd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lgtm

return X, Y


def get_weighted_roll_func(cfunc: Callable) -> Callable:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Subtypes for Callable would be helpful here if you know from looking at this what they are

@jreback
Copy link
Contributor

jreback commented Jan 5, 2020

thanks @mroeschke

doc-strings and types always welcome

@jreback jreback merged commit 863a6a4 into pandas-dev:master Jan 5, 2020
@mroeschke mroeschke deleted the clean_rolling branch April 21, 2020 16:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Clean Window rolling, ewma, expanding

4 participants