vendredi 15 juillet 2016

Replace a column in a numpy matrix

I'm trying to inter-change columns from 2 matrices, but my assignment seems to not be doing it.

crom1 = crossover_list[0][0][:,j]
print('c1', crom1)
crom2 = crossover_list[1][0][:,j]
print('c2', crom2)

crossover_list[0][0][:,j] = crom2

print(crossover_list[1][0][:,j])
crossover_list[1][0][:,j] = crom1
print(crossover_list[1][0][:,j])

And this is what comes out: enter image description here

Any suggestions?

LE: I also tried the following, with no success:

aux = crossover_list[0][0][:,j]
crossover_list[0][0][:,j] = crossover_list[1][0][:,j]
crossover_list[1][0][:,j] = aux

Aucun commentaire:

Enregistrer un commentaire