[SciPy-user] Again on Sorting Objects

Alan G Isaac aisaac@american....
Mon Jan 21 14:29:55 CST 2008


On Mon, 21 Jan 2008, Johann Cohen-Tanugi apparently wrote:
> great little tools. I realized following this thread that it would be 
> extremely handy for me to have a fast easy way to do this 
> groupby but on 2D arrays.

Unfortunately you cannot quite do this, I think, but you can do:

for k,v in groupby(a,lambda x: x[0]): print N.array(list(v))

hth,
Alan Isaac






More information about the SciPy-user mailing list