I write a simple code list below:
data = np.array([[1,1,1],[2,3,4]])
xdata = [i + 0.1 for i in data[0]]
print(xdata)
data[0] = xdata
print(data)
But the result I get in console i
[1.1, 1.1, 1.1]
[[1 1 1]
[2 3 4]]
While I expect it to be
[1.1, 1.1, 1.1]
[[1.1 1.1 1.1]
[2 3 4]]
Why I can't change the value in NumPy array this way?
dataas created can only holdintvalues.xdata = [i + 0.1 for i in data[0]]is better written axdata = data[0]+0.1