Skip to content

Conversation

@mroeschke
Copy link
Member

@mroeschke mroeschke commented Jan 12, 2020

@mroeschke mroeschke added Enhancement Window rolling, ewma, expanding labels Jan 12, 2020
@mroeschke mroeschke added this to the 1.1 milestone Jan 12, 2020
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.

Thanks! Do we have any benchmarks for this?

raw=False,
engine="cython",
engine_kwargs=None,
args=None,
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 totally equivalent? I get the impression previously should have been *args and **kwargs so a little strange as is, but I don't think converting to None is totally the same?

Copy link
Member Author

Choose a reason for hiding this comment

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

Previously the docs described rolling/expanding.apply being able to take *args, **kwargs: https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.core.window.Expanding.apply.html

But in actuality, the arguments were args=(), kwargs={}: https://github.com/pandas-dev/pandas/blob/0.25.x/pandas/core/window.py#L2128

Since the docs were incorrect, and the prior arguments has a mutable default argument, I changed rolling.apply to be args=None, kwargs=None (later converting to args=(), kwargs={} internally if still None), and I am doing the same here for expanding.apply.

So slightly changing the behavior, but taking advantage of the fact the docs were incorrect in the first place.

func,
raw=False,
engine="cython",
engine_kwargs=None,
Copy link
Member

Choose a reason for hiding this comment

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

Can you add annotation for this? I assume Dict[str, Any] unless can further subset the provided values

Copy link
Contributor

@jreback jreback left a comment

Choose a reason for hiding this comment

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

lgtm.

@jreback jreback modified the milestones: 1.1, 1.0.0 Jan 15, 2020
@jreback
Copy link
Contributor

jreback commented Jan 15, 2020

actually ok for 1.0.0; can you add this issues / PR number to the whatsnew note that already existis for rolling.apply

@jreback jreback merged commit e4a96bb into pandas-dev:master Jan 16, 2020
@mroeschke mroeschke deleted the feature/expanding_apply_engine branch January 16, 2020 21:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Enhancement Window rolling, ewma, expanding

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ENH: Add engine keyword argument to expanding.apply to leverage Numba

3 participants