Or use pandas
's Series.mean
method:
pd.Series(sequence).mean()
Demo:
>>> import pandas as pd>>> l = [15, 18, 2, 36, 12, 78, 5, 6, 9]>>> pd.Series(l).mean()20.11111111111111>>>
From the docs:
Series.mean(axis=None, skipna=None, level=None, numeric_only=None, **kwargs)
¶
And here is the docs for this:
https://pandas.pydata.org/pandas-docs/stable/generated/pandas.Series.mean.html
And the whole documentation: