Skip to content
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

ENH: All args and kwargs to generic expanding/rolling apply. #6289

Closed
wants to merge 3 commits into from

Conversation

jseabold
Copy link
Contributor

@jseabold jseabold commented Feb 6, 2014

Been bugging me lately. Simple enough fix I think. Example usage

def mean(x, const):
    return np.mean(x) + const

df = pd.DataFrame(np.random.rand(20, 3))
pd.expanding_apply(df, mean, args=(20,)

pd.expanding_apply(df, mean, kwargs=dict(const=20))

@jreback jreback added this to the 0.14.0 milestone Feb 6, 2014
@jreback
Copy link
Contributor

jreback commented Feb 6, 2014

sure

@jseabold
Copy link
Contributor Author

jseabold commented Feb 6, 2014

Fixed failing tests. Maybe hack-ish.

@jreback
Copy link
Contributor

jreback commented Feb 6, 2014

this loooks indepedent of #5071 yes?

@jseabold
Copy link
Contributor Author

jseabold commented Feb 6, 2014

Yeah, I didn't find an open issue for this.

@jreback
Copy link
Contributor

jreback commented Feb 7, 2014

not sure of the test coverage here; but are their any tests for a function which doesn't take any arguments? (e.g. does it still work)? I assume cython raises some kind of error if the function take args but they are not supplied?

@jseabold
Copy link
Contributor Author

jseabold commented Feb 7, 2014

Yeah, it will raise. That's why I added the args=(), kwargs={} to the Python signatures, so that there are always defaults. AFAIK, the Cython function isn't used outside of the wrappers in moments.py, so it should be enough to ensure that the wrapper functions always call algos.roll_generic with some default args.

@jreback
Copy link
Contributor

jreback commented Feb 7, 2014

merged via 1e9c0a6

thanks!

@jreback jreback closed this Feb 7, 2014
@jseabold jseabold deleted the expandings-args branch February 10, 2014 22:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
API Design Enhancement Reshaping Concat, Merge/Join, Stack/Unstack, Explode
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants