python make an average function code example
Example 1: average python
import numpy as np
values=[1,10,100]
print(np.mean(values))
values=[1,10,100,np.nan]
print(np.nanmean(values))
Example 2: python average
def avrg(values): # where values is a list of all values
return sum(values)/len(values)