Skip to content

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

2 participants