[Numpy-discussion] Question regarding concatenate/vstack.

andrew nelson andyfaff at gmail.com
Wed Mar 30 06:30:46 EDT 2011


Dear List,
I have a quick question regarding vstack and concatenate.
In the docs for vstack it says that:

np.concatenate(tup, axis=0)

should be equivalent to:

np.vstack(tup)

However, I tried this out and it doesn't seem to be case, i.e.

>>> np.vstack((np.arange(5.), np.arange(5.)))
array([[ 0.,  1.,  2.,  3.,  4.],
       [ 0.,  1.,  2.,  3.,  4.]])

>>> np.concatenate((np.arange(5.),np.arange(5.)), axis=0)
array([ 0.,  1.,  2.,  3.,  4.,  0.,  1.,  2.,  3.,  4.])

These aren't the same. Maybe I'm missing something?

regards,
Andrew.



More information about the NumPy-Discussion mailing list