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

reduceat should handle outlier indices gracefully (Trac #237) #835

Open
numpy-gitbot opened this issue Oct 19, 2012 · 4 comments
Open

reduceat should handle outlier indices gracefully (Trac #237) #835

numpy-gitbot opened this issue Oct 19, 2012 · 4 comments

Comments

@numpy-gitbot
Copy link

Original ticket http://projects.scipy.org/numpy/ticket/237 on 2006-08-07 by trac user martin_wiechert, assigned to unknown.

to the very least .reduceat (a, I) should accept len (a) in I

usage example:

def weighted_histo (binborders, data):
    sd = sort (data)
    I = sd.searchsorted (binborders)
    # Now elements of I may range between 0 and len (sd).
    return add.reduceat (sd, I)
@numpy-gitbot
Copy link
Author

@teoliphant wrote on 2006-08-08

Be more specific about the desired behavior. Instead of raising an error, should it instead return the identity of the operator (assuming one is defined).

@numpy-gitbot
Copy link
Author

trac user martin_wiechert wrote on 2006-08-08

At least for nondecreasing I the "natural" (read: expected by naive user like me) behaviour would be

<operator>.reduceat (a, I) ==
array ([<operator>.reduce (a [i:j]) for i,j in zip (I, r_[I [1:], len (a)])])

Cf. also ticket #834.

@numpy-gitbot
Copy link
Author

Milestone changed to 1.1 by @alberts on 2007-05-12

@numpy-gitbot
Copy link
Author

Milestone changed to Unscheduled by @cournape on 2009-03-02

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants