[Pythoneers] numpy array transformations
Philipp Plewa
pmplewa at mpe.mpg.de
Tue Feb 10 11:51:25 CET 2015
Here are two suggestions:
np.vstack((a,b)).T
np.dstack((a,b))[0]
Cheers,
Philipp
> On 10.02.2015, at 11:39, Leonard Burtscher <burtscher at mpe.mpg.de> wrote:
>
> 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
>
>
> _______________________________________________
> Pythoneers mailing list
> Pythoneers at lists.mpe.mpg.de
> https://lists.mpe.mpg.de/cgi-bin/mailman/listinfo/pythoneers
More information about the Pythoneers
mailing list