I was wondering if there a method that can subtract values? Something similar to sum
for Examples
> np.array([[10, 2], [1, 2]]).sum()
15
" imaginary method "
> np.array([[10, 2], [1, 2]]).sub()
6
# axis = 1
> np.array([[10, 2], [1, 2]]).sum(axis=1)
array([12, 3])
" imaginary method "
> np.array([[10, 2], [1, 2]]).sum(axis=1)
array([8, -1])
# axis = 0
> np.array([[10, 2], [1, 2]]).sum(axis=0)
array([11, 4])
"imaginary"
> np.array([[10, 2], [1, 2]]).sub(axis=0)
array([9, 0])
I am frustrated I cann't find anything in docs (somehow numpy docs are not easy to use if you don't know what you looking for).
thank you.
sum-like method. You'd have two arrays and doa - b.sum.np.diffthat's kind of related and that I occasionally use to do subtraction, but it's probably obfuscating to use that when actually want to do row/col subtraction and not doing finite-differences.diff()orsubtract()?