[Numpy-discussion] stacking scalars with column vector
Santhosh R
san.programming at gmail.com
Sun Dec 4 21:40:05 EST 2011
Thanks Oliver.
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...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20111205/2b44e82a/attachment.html>
More information about the NumPy-Discussion
mailing list