[Numpy-discussion] stacking scalars with column vector
san.programming at gmail.com
Sun Dec 4 21:40:05 EST 2011
You can do it in one shot with:
> x = np.vstack((Xstart, A[:, 0:1], Xend))
> Using A[:, 0:1] instead of A[:, 0] lets you keep it as a 2d matrix (this
> should answer your last question).
> Then the scalars Xstart and Xend will automatically be broadcasted to
> accomodate the shape of A[:, 0:1], so you don't need to write [[Xstart]]
> and [[Xend]].
> -=- Olivier
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the NumPy-Discussion