[SciPy-user] Add a column to masked array.
Dharhas Pothina
Dharhas.Pothina at twdb.state.tx.us
Thu Jul 2 13:52:17 EDT 2009
thank you. ma.column_stack works great.
- d
>>> Pierre GM <pgmdevlist at gmail.com> 7/2/2009 11:57 AM >>>
On Jul 2, 2009, at 11:58 AM, Dharhas Pothina wrote:
> Hi,
>
> I have a masked array 'data' where data.shape = (1805,4) and another
> masked array 'a' where a.shape = (1805,)
>
> I would like to generate a new masked array with the 'a' as the last
> column , i.e. the final shape should be (1805,5).
Try ma.column_stack
>>> x=ma.masked_all((10,3))
>>> y=np.random.rand(10)
>>> ma.column_stack((x,y)).shape
(10,4)
> I've tried np.hstack which gave an error 'arrays must have same
> number of dimensions'
The corresponding standard numpy functions don't know how to process
the mask and tend to fail miserably.
> and ma.hstack just combines both masked arrays into a list.
I've never been able to remember what vstack, hstack and stack do
respectively, so I use error/trial and the online help...
_______________________________________________
SciPy-user mailing list
SciPy-user at scipy.org
http://mail.scipy.org/mailman/listinfo/scipy-user
More information about the SciPy-User
mailing list