📜  python手动计算方差 - Python代码示例

📅  最后修改于: 2022-03-11 14:45:51.746000             🧑  作者: Mango

代码示例1
# calculate mean
m = sum(results) / len(results)

# calculate variance using a list comprehension
var_res = sum((xi - m) ** 2 for xi in results) / len(results)