def average(xs: List[Union[None, float]]) -> float:
"""Calculate the arithmetic mean of the given values (possibly None)
>>> '{:.2f}'.format(average([None, 1.0, 2.0]))
'1.50'
"""
return numpy.mean([x for x in xs if x is not None])
评论列表
文章目录