Join GitHub today
GitHub is home to over 20 million developers working together to host and review code, manage projects, and build software together.
BUG: resample unexpectedly branching on type of `how` callable #7929
Comments
|
groupby first calls the function as a DataFrame (to evaluate it as a single block) then will call it series by series if that doesn't work I don't think this is a bug but rather state being captured in the closure but u would have to step thru and see |
|
What does "it doesn't work" mean here? In each case, the |
|
ok, a very odd bug so, every function has a
The reason for this is convience feature I think something like this:
e.g. it figures out the name of the |
jreback
added Bug API Design Groupby Error Reporting and removed Error Reporting
labels
Aug 4, 2014
jreback
added this to the
0.15.0
milestone
Aug 4, 2014
|
@dsm054 want to take a stab at fixing? search for |
|
Class instances don't have a default |
|
Okay, I've got a working branch with tests, but am I alone in thinking the API for this is actually a little strange? If I pass a (1) What do we want to do for names of things which don't really have them? At the moment we can't pass multiple lambdas. (2) Is there a good place to toss a small utility function like |
|
The problem is that they NEED to be put in a dict ATM, somewhat related here: pydata#6515 I think it might be better to simply number the columns if they don't have a name (and de-annomize the lambdas too). e.g. my example above with or maybe I think this is why @wesm punted on this, have to name them something.
|
|
We could add a layer of nesting, e.g. If we're fixing duplicate names of the empty variety, should we also allow multiple sums (e.g. |
|
yep, I would be ok with
or a dict too (I don't think you need a nested dict? |
|
I like the Series idea. Any objection to my submitting a PR to fix the original bug first, and then opening a followup ENH? |
|
sure on both counts! |
dsm054 commentedAug 4, 2014
I was about to answer an SO question giving the standard "use
lambdaorfunctools.partial" to create a new function with bound arguments when to my surprise my example didn't work with the OP's code. After some experimentation, it turns out to be because we don't always get the same return type. For example:After which:
howshouldn't care about how the function was constructed, only whether it's callable, and we should be getting the same result (whether Series or DataFrame) fed intohowin every case.