Search
 
SCRIPT & CODE EXAMPLE
 

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]
Comment

PREVIOUS NEXT
Code Example
Python :: python print date, time and timezone 
Python :: python .findall 
Python :: use proxy to connect smtp python 
Python :: convert list to string separated by comma python 
Python :: ubuntu 20.10 python 3.8 
Python :: tkinter python 
Python :: make venv 
Python :: gensim show_topics get topic 
Python :: combine list of dicts 
Python :: creating class and object in python 
Python :: mkdir if not exists python 
Python :: power of array 
Python :: if else python 
Python :: how to find index of maximum value in dataframe in python 
Python :: cursor.fetchall() to list 
Python :: python json write utf 8 
Python :: python check if file is writable 
Python :: nested loop 
Python :: python backslash in string 
Python :: how to get SITE_ID in django....shell 
Python :: empty list in python 
Python :: know the type of variable in python 
Python :: save seaborn lmplot 
Python :: python - join two columns and transform it as index 
Python :: balancing paranthesis python 
Python :: join lists python 
Python :: chrome webdrivermanager 
Python :: input code for python 
Python :: python get name of vlue 
Python :: matplotlib axis labels 
ADD CONTENT
Topic
Content
Source link
Name
2+1 =