robert.kern at gmail.com
Thu Jul 18 13:03:06 EDT 2013
On Thu, Jul 18, 2013 at 5:57 PM, Alan G Isaac <alan.isaac at gmail.com> wrote:
> I'm floating this thought even though it is not fleshed out.
> On occasion, I run into the following problem:
> I have a rectangular array A to which I want to append
> a (probably) one dimensional vector b to make [A|b].
> Of course this can be done as np.hstack((x,b[:,None]))
> (or obscurely np.r_['1,2,0',x,b]), but this has the following issues:
> - what if ``b`` turns out to be a list?
> - what if ``b`` turns out to be 2d (e.g., a column vector)?
> - it's a bit ugly
> - it is not obvious when read by others (e.g., students)
np.column_stack([x, b]) does everything you need.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the NumPy-Discussion