题解 | #某类鸢尾花数据方差#
某类鸢尾花数据方差
http://www.nowcoder.com/practice/77ea4f53a45c43ee95d78f513d79496c
import pandas as pd import numpy as np iris = pd.read_csv('iris.csv', sep=',') iris_virginica_fea = iris[iris['type'] == 'Iris-virginica'] print(iris_virginica_fea.iloc[:,:4].var(ddof=0))
注意:df.var(ddof=0或1) ddof=0 按照样本方差公式计算 ddof=1 按照方差计算 默认ddof=0 因此要设置参数ddof=1