[Numpy-discussion] Stacking arrays along new dimension in front

Gael Varoquaux gael.varoquaux at normalesup.org
Tue Jul 20 05:11:09 EDT 2010


Is there in numpy a function that does:

    np.concatenate([a_[np.newaxis] for a_ in a])

?

ie: add a dimension in front and stack along this dimension, just like 

    np.array(a)

would do, but more efficient.

This is something that do all the time. Am I the only one?

Cheers,

Gaël



More information about the NumPy-Discussion mailing list