I have a list of length 50 created using linspace:
m=np.linspace(0,10,50)
I can recast this as a 10 X 5 matrix using reshape
X=np.reshape(m,(10,5))
But, if I want to use for-loops to do the same thing, I get an error:
z=np.zeros((10,5),dtype=float)
s=0
for i in range(0,10):
for j in range(0,5):
m[i][j]=z[s]
s=s+1
here is the error:
'numpy.float64' object does not support item assignment
Why isn't the item assignment supported?
Thanks
m? Your code assumes that it's already some 2D structure, but you've never defined it.