[Numpy-discussion] np.concatenate and np.column_stack shouldn't they be the same?
Robert Kern
robert.kern at gmail.com
Fri Jul 10 11:28:23 EDT 2009
On Fri, Jul 10, 2009 at 07:40, John [H2O]<washakie at gmail.com> wrote:
>
> Can someone explain:
>
> x = np.arange(20)
> y = np.arange(20)
>
> z = np.vstack((x,y)).T
>
> is equal to:
>
> z = np.column_stack((x,y))
>
> but this does not do the same:
>
> z = np.concatenate((x,y),axis=0) # or with axis=1
>
> Seems I should be able to use concatenate to make a column stack??
z = np.concatenate((x[:,np.newaxis], y[:,np.newaxis]), axis=1)
--
Robert Kern
"I have come to believe that the whole world is an enigma, a harmless
enigma that is made terrible by our own mad attempt to interpret it as
though it had an underlying truth."
-- Umberto Eco
More information about the NumPy-Discussion
mailing list