题解 | #某类鸢尾花数据方差#

某类鸢尾花数据方差

http://www.nowcoder.com/practice/77ea4f53a45c43ee95d78f513d79496c

注意 np.varpd.DataFrame.var 的区别

  • np.var:默认 ddof=0
  • pd.DataFrame.var:默认 ddof=1

ddof

"Delta Degrees of Freedom": the divisor used in the calculation is N - ddof, where N represents the number of elements.

题目输出的结果是 ddof=0

import pandas as pd
import numpy as np
iris = pd.read_csv('iris.csv', sep=',')
virginica = iris[iris['type']=='Iris-virginica']
print(np.var(virginica))
全部评论

相关推荐

10-01 09:50
门头沟学院 Java
肖先生~:这个人真的很好,点赞
点赞 评论 收藏
分享
评论
4
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务