[Numpy-discussion] Numpy 'groupby'
Wed Jan 11 19:27:46 CST 2012
On Wed, Jan 11, 2012 at 7:05 AM, Neal Becker <firstname.lastname@example.org> 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??
> I've played with groupby in pandas.
> NumPy-Discussion mailing list
I agree (unsurprisingly) that pandas is your best bet:
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
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.
More information about the NumPy-Discussion