Comment additionner deux tableaux en Python ?
Le moyen le plus simple d'additionner deux tableaux (np.array) en Python est d'utiliser la méthode np.add(). Voici un exemple :
import numpy as np
A = np.array([1, 2, 3, 4])
B = np.array([0, 2, 4, 5])
# Addition : R = A + B
R = np.add(A, B)
# R = [1 4 7 9]
print(R)
Le moyen le plus simple d'additionner deux tableaux (np.array) en Python est d'utiliser la méthode np.add(). Voici un exemple :
import numpy as np
A = np.array([1, 2, 3, 4])
B = np.array([0, 2, 4, 5])
# Addition : R = A + B
R = np.add(A, B)
# R = [1 4 7 9]
print(R)
Le moyen le plus simple d'additionner deux tableaux (np.array) en Python et d'utiliser la méthode np.add(). Voici un exemple :
import numpy as np
A = np.array([1, 2, 3, 4])
B = np.array([0, 2, 4, 5])
# Addition : R = A + B
R = np.add(A, B)
# R = [1 4 7 9]
print(R)
| # | ID | Query | URL | Count |
|---|---|---|---|---|
| 0 | 9325 | python additionner 2 tableaux | https://fr.ans.wiki/1248/comment-additionner-deux-tableaux-en-python | 1 |
| 1 | 7448 | https://fr.ans.wiki/1248/comment-additionner-deux-tableaux-en-python/ | https://fr.ans.wiki/1248/comment-additionner-deux-tableaux-en-python | 1 |