How to subtract arrays in Python?
The best way to subtract two arrays (np.array
) in Python is to use the np.subtract()
method. Here is an example:
import numpy as np
A = np.array([1, 2, 3, 4])
B = np.array([1, 4, 2, 8])
# Subtraction: R = A - B
R = np.subtract(A, B)
# R = [0 -2 1 -4]
print(R)
The best way to subtract two arrays (np.array
) in Python is to use the np.subtract()
method. Here is an example:
import numpy as np
A = np.array([1, 2, 3, 4])
B = np.array([1, 4, 2, 8])
# Subtraction: R = A - B
R = np.subtract(A, B)
# R = [0 -2 1 -4]
print(R)
The best way to subtract two arrays (np.array
) in Python is to use the np.subtract()
method. Here is an example:
import numpy as np
A = np.array([1, 2, 3, 4])
B = np.array([1, 4, 2, 8])
# Subtraction : R = A - B
R = np.subtract(A, B)
# R = [0 -2 1 -4]
print(R)
# | ID | Query | URL | Count |
---|