Skip to content

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

Open

Description

@numpy-gitbot

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)

Activity

  1. numpy-gitbot commented on Oct 23, 2012

    @numpy-gitbot
    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).

  2. numpy-gitbot commented on Oct 23, 2012

    @numpy-gitbot
    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.

  3. numpy-gitbot commented on Oct 23, 2012

    @numpy-gitbot
    Author

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

  4. numpy-gitbot commented on Oct 23, 2012

    @numpy-gitbot
    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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions