[Pythoneers] numpy array transformations

Leonard Burtscher burtscher at mpe.mpg.de
Tue Feb 10 11:39:41 CET 2015


Hi pythoneers,

Let me try this list with a simple question: I have two numpy ndarrays (a,b), each of size (140,1), and would like to make them a single array of size (140,2).

I can do this with
import numpy as np
a=np.arange(140,1)
b=np.arange(140,1)

c=np.concatenate((a,b))
d=c.reshape(140,2)

...but I'm sure there's a shorter way to that. Does anyone know how?

Thanks and cheers,
Leo




More information about the Pythoneers mailing list