mardi 5 février 2019

Dependence of numpy.random.shuffle()

I have a simple example.

import numpy as np

w=np.arange(12).reshape((4,3))
print w
#[[ 0  1  2] [ 3  4  5] [ 6  7  8] [ 9 10 11]]
q=w
np.random.shuffle(q)
print w
#[[ 6  7  8] [ 9 10 11] [ 0  1  2] [ 3  4  5]]

How do I create a new array q so that numpy.random.shuffle() doesn't effect w?




Aucun commentaire:

Enregistrer un commentaire