Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

python average of two lists by row

# Basic syntax:
[(a + b)/2 for a, b in zip(list_1, list_2)]

# Example usage:
list_1 = [1, 2, 3]
list_2 = [4, 5, 6]
[(a + b)/2 for a, b in zip(list_1, list_2)]
--> [2.5, 3.5, 4.5]
Comment

average of two lists python

>>> import numpy as np
>>> data = np.array([[1, 2, 3], [5, 6, 7]])
>>> np.average(data, axis=0)
array([ 3.,  4.,  5.])
Comment

PREVIOUS NEXT
Code Example
Python :: opencv write text 
Python :: filter list with python 
Python :: sleep in py 
Python :: python copy file to another directory 
Python :: csv to numpy array 
Python :: python float till 2 decimal places 
Python :: pip install torch error 
Python :: pandas capitalize column 
Python :: cv2 save video mp4 
Python :: np array value count 
Python :: pandas sum multiple columns groupby 
Python :: valueerror expected 2d array got 1d array instead python linear regression 
Python :: disable devtools listening on ws://127.0.0.1 python 
Python :: python flatten dict 
Python :: pandas drop rows with null in specific column 
Python :: pandas datetime show only date 
Python :: opencv python convert rgb to hsv 
Python :: proxy selenium python 
Python :: plotly write html 
Python :: how to loop the length of an array pytoh 
Python :: pandas convert date to string 
Python :: plotly add hline dashed 
Python :: django settings variables 
Python :: triangle pygame 
Python :: how to count stopwords in df 
Python :: formula for compounding interest in python 
Python :: how to find and replace all the punctuation in python strings 
Python :: matplotlib set dpi 
Python :: why when I merge my label cluster with my dataframe i get more row 
Python :: qspinbox value changed 
ADD CONTENT
Topic
Content
Source link
Name
9+9 =