I'm using the np.broadcast_to
function to get a view on a reshaped array just like the example:
>>> x = np.array([1, 2, 3])
>>> np.broadcast_to(x, (3, 3))
array([[1, 2, 3],
[1, 2, 3],
[1, 2, 3]])
Passing a masked array to this function loses me the mask though:
>>> y = np.ma.array([1, 2, 3], mask=[False, True, False])
>>> np.broadcast_to(y, (3, 3))
array([[1, 2, 3],
[1, 2, 3],
[1, 2, 3]])
How do I get the following view?
array([[1, --, 3],
[1, --, 3],
[1, --, 3]])