Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

python sum lists element wise

import numpy as np
vector1 = np.array([1, 2, 3])
vector2 = np.array([4, 5, 6])

#Doing the element-wise addition is now as trivial as:
sum_vector = vector1 + vector2
print(sum_vector)

# [5 7 9]
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #python #sum #lists #element #wise
ADD COMMENT
Topic
Name
5+4 =