Is there a built-in or standard library method in Python to calculate the arithmetic mean (average) of a list of numbers?
I am not aware of anything in the standard library. However, you could use something like:
float(sum(l))/len(l) if len(l) > 0 else float('nan')
In numpy, there's