zoukankan      html  css  js  c++  java
  • 利用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分位数

  • 相关阅读:
    3.24课堂
    3.23作业
    3.23课堂
    3.20作业
    3.20课堂
    3.19作业
    3.19课堂
    3.18课堂
    3.18作业
    46、表与表的连接
  • 原文地址:https://www.cnblogs.com/xiyuan2016/p/9063743.html
Copyright © 2011-2022 走看看