Scott Sinclair scott.sinclair.za at gmail.com writes:
import numpy as np
x = np.eye(3)
x
array([[ 1., 0., 0.],
[ 0., 1., 0.],
[ 0., 0., 1.]])
x.resize((5,5))
Traceback (most recent call last):
File stdin, line 1, in module
ValueError: cannot resize an array
Hi,
I'm confused by the following:
import numpy as np
np.__version__
'1.3.0.dev6116'
# I expect this
x = np.eye(3)
x.resize((5,5))
x = np.eye(3)
y = x
x.resize((5,5))
Traceback (most recent call last):
File stdin, line 1, in module
ValueError: cannot resize an array that has been
I thought it was a self contained snippet ;-)
Here's another attempt that shows _ is the cause of my confusion.
import numpy as np
x = np.eye(3)
x
array([[ 1., 0., 0.],
[ 0., 1., 0.],
[ 0., 0., 1.]])
x.resize((5,5))
Traceback (most recent call last):
File stdin, line 1,