jrdioko - 1 year ago 210

Python Question

Is there a built-in or standard library method in Python to calculate the arithmetic mean (average) of a list of numbers?

Answer Source

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 `numpy.mean()`

.