[Numpy-discussion] array view with different shape

Mark Bakker markbak@gmail....
Wed Sep 15 04:01:21 CDT 2010

Hello List,

Can I make a view of an entire array but with a different shape?

For example:

a = zeros((2,3,4))

Now I want array b to be identical to a, but with shape (2,12).

b = a; b.shape = (2,12)

This doesn't work, of course, as also the shape of a changes.
I know I can simply make a copy of a and change the shape, but can I make b
to be a view of a (so that when I change a, then b changes as well)?


-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/numpy-discussion/attachments/20100915/42ec74a3/attachment.html 

More information about the NumPy-Discussion mailing list