Hello.
Je fait face à une erreur que je ne comprend pas. Voici mon code:
et voici mes outputprint "tata = ", tata
print "tata.shape = ", tata.shape
Indicatrice = (tata < 1e-10)
test1 = tata + Indicatrice
test2 = tata * Indicatrice
puis un long message d'erreur qui se termine partata = [[ 0.37754067]
[ 0.37754067]
[ 0.37754067]]
tata.shape = (3, 1)
Je ne comprend pas cette erreur, il me semble pourtant que l’opérateur * multiplie terme les array.ValueError: shapes (3,1) and (3,1) not aligned: 1 (dim 1) != 3 (dim 0)
Le plus incompréhensible est que le code:
Lui fonctionne parfaitement.print "tata = ", tata
print "tata.shape = ", tata.shape
tata = np.array(tata)
Indicatrice = np.array(tata < 1e-10)
test1 = tata + Indicatrice
test2 = tata * Indicatrice
Quelqu’un comprend-il l’erreur ici? Mon «tata» initial peut-il être autre chose qu’un array sachant qu’on peut lui appliquer une methode .shape?
Merci à ceux qui pourront me répondre.
Cordialement.
Partager