Return the weighted average of array over the specified axis.
Parameters: | a : array_like
axis : int, optional
weights : array_like, optional
returned : bool, optional
|
---|---|
Returns: | average, [sum_of_weights] : {array_type, double}
|
Raises: | ZeroDivisionError :
TypeError :
|
See also
Examples
>>> data = range(1,5)
>>> data
[1, 2, 3, 4]
>>> np.average(data)
2.5
>>> np.average(range(1,11), weights=range(10,0,-1))
4.0