On Wed, Jan 11, 2012 at 7:05 AM, Neal Becker <ndbeck...@gmail.com> wrote: > Michael Hull wrote: > >> Hi Everyone, >> First off, thanks for all your hard work on numpy, its a really great help! >> I was wondering if there was a standard 'groupby' in numpy, that >> similar to that in itertools. >> I know its not hard to write with np.diff, but I have found myself >> writing it on more than a couple of occasions, and wondered if >> there was a 'standarised' version I was missing out on?? >> Thanks, >> >> >> Mike > > I've played with groupby in pandas. > > _______________________________________________ > NumPy-Discussion mailing list > NumPy-Discussion@scipy.org > http://mail.scipy.org/mailman/listinfo/numpy-discussion
I agree (unsurprisingly) that pandas is your best bet: http://pandas.sourceforge.net/groupby.html I've had it on my TODO list to extend the pandas groupby engine (which has grown fairly sophisticated) to work with generic ndarrays and record arrays: https://github.com/wesm/pandas/issues/123 It shouldn't actually be that hard for most simple cases. I could imagine the results of a groupby being somewhat difficult to interpret without axis labeling/indexing, though. cheers, Wes _______________________________________________ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion