I believe this is basically a groupby, which is one of pandas's core competencies... even if numpy were to add some utilities for this kind of thing, then I doubt we'd do as well as them, so you might check whether pandas works for you first :-) On Feb 12, 2016 6:40 AM, "Sérgio" <filab...@gmail.com> wrote:
> Hello, > > This is my first e-mail, I will try to make the idea simple. > > Similar to masked array it would be interesting to use a label array to > guide operations. > > Ex.: > >>> x > labelled_array(data = > [[0 1 2] > [3 4 5] > [6 7 8]], > label = > [[0 1 2] > [0 1 2] > [0 1 2]]) > > >>> sum(x) > array([9, 12, 15]) > > The operations would create a new axis for label indexing. > > You could think of it as a collection of masks, one for each label. > > I don't know a way to make something like this efficiently without a loop. > Just wondering... > > Sérgio. > > _______________________________________________ > NumPy-Discussion mailing list > NumPy-Discussion@scipy.org > https://mail.scipy.org/mailman/listinfo/numpy-discussion > >
_______________________________________________ NumPy-Discussion mailing list NumPy-Discussion@scipy.org https://mail.scipy.org/mailman/listinfo/numpy-discussion