I am having this unusual problem with shuffling arrays in numpy
arr = np.arange(9).reshape((3, 3))
print "Original constant array"
print arr
new_arr=arr
for i in range(3):
np.random.shuffle(new_arr)
print "Obtained constant array"
print arr
print "randomized array"
print new_arr
arr
is my original array which I kept as such and created new array new_arr
for further computation. But the code is showing this output
Original constant array
[[0 1 2]
[3 4 5]
[6 7 8]]
Obtained constant array
[[6 7 8]
[0 1 2]
[3 4 5]]
randomized array
[[6 7 8]
[0 1 2]
[3 4 5]]
I only wants to randomize new_arr
and not arr
. why this is happening and how to prevent arr
from shuffling?