MaskedArray.reshape(*s, **kwargs)

Returns a masked array containing the data of a, but with a new shape. The result is a view to the original array; if this is not possible, a ValueError is raised.


shape : shape tuple or int

The new shape should be compatible with the original shape. If an integer, then the result will be a 1D array of that length.

order : {‘C’, ‘F’}, optional

Determines whether the array data should be viewed as in C (row-major) order or FORTRAN (column-major) order.


reshaped_array : array

A new view to the array.


If you want to modify the shape in place, please use a.shape = s


>>> x =[[1,2],[3,4]], mask=[1,0,0,1])
>>> print x
[[-- 2]
 [3 --]]
>>> x = x.reshape((4,1))
>>> print x

Previous topic

Next topic

This Page

Quick search