利用describe( )中的count来检查数据是否缺省

1 #-*- coding: utf-8 -*-
2 #在python的pandas库中,只需要读入数据,然后使用describe()函数就可以查看数据的基本情况
3 import pandas as pd
4 inputDataSources = '../data/data.xls'
5 data = pd.read_excel(inputDataSources, index_col=u'日期') #读取数据,指定‘日期’列为索引行
6 print data.describe() 
7 print '数据源行数:',len(data)

output:

                销量
count   200.000000
mean   2755.214700
std     751.029772
min      22.000000
25%    2451.975000
50%    2655.850000
75%    3026.125000
max    9106.440000
数据源行数: 201

其中count是指非空值数,通过len(data)可以得知数据记录是201行 ------->数据缺失值数为 1

25%、 50%、 75% 也就是 1/4、1/2、3/4分位数

原文地址:https://www.cnblogs.com/xiyuan2016/p/9063743.html