Numeric/Numarray equivalent to zip ?

Robert Kern rkern at ucsd.edu
Sat Apr 30 18:00:36 EDT 2005


George Sakkis wrote:
> What's the fastest and most elegant equivalent of zip() in
> Numeric/Numarray between two equally sized 1D arrays ? That is, how to
> combine two (N,)-shaped arrays to one (N,2) (or (2,N)) shaped ? I
> expect the fastest and the most elegant idiom to be identical, as it is
> usually the case in this excellent library, but if not, both would be
> useful to know. Thanks,

Look at combining concatenate(), reshape(), and transpose(). In Scipy, I 
would use hstack() and vstack().

-- 
Robert Kern
rkern at ucsd.edu

"In the fields of hell where the grass grows high
  Are the graves of dreams allowed to die."
   -- Richard Harter




More information about the Python-list mailing list