I am currently working on a python script that extracts measurement data from a text file. I am working with iPython Notebook and Python 2.7
Now I am faced with some odd behavior when working with numpy arrays. I have no explanation.
myArray = numpy.zeros((4,3))
myArrayTransposed = myArray.transpose()
for i in range(0,4):
for j in range(0,3):
myArray[i][j] = i+j
print myArray
print myArrayTransposed
leads to:
[[ 0. 1. 2.]
[ 1. 2. 3.]
[ 2. 3. 4.]
[ 3. 4. 5.]]
[[ 0. 1. 2. 3.]
[ 1. 2. 3. 4.]
[ 2. 3. 4. 5.]]
Thus, without working with the transposed array, the values are updated in this array.
How is this possible?
source
share