[Numpy-discussion] array view with different shape
Pierre GM
pgmdevlist@gmail....
Wed Sep 15 04:06:13 CDT 2010
On Sep 15, 2010, at 11:01 AM, Mark Bakker wrote:
> Hello List,
>
> Can I make a view of an entire array but with a different shape?
>
> For example:
>
> a = zeros((2,3,4))
Mark,
Try that.
b = a.reshape((2,12))
Now,
>>> b.flat=1
>>> a
array([[[ 1., 1., 1., 1.],
[ 1., 1., 1., 1.],
[ 1., 1., 1., 1.]],
[[ 1., 1., 1., 1.],
[ 1., 1., 1., 1.],
[ 1., 1., 1., 1.]]])
More information about the NumPy-Discussion
mailing list