1. #-*- coding: utf-8 -*-
    2. #餐饮销量数据统计量分析
    3. from __future__ import print_function
    4. import pandas as pd
    5. catering_sale = '../data/catering_sale.xls' #餐饮数据
    6. data = pd.read_excel(catering_sale, index_col = u'日期') #读取数据,指定“日期”列为索引列
    7. data = data[(data[u'销量'] > 400)&(data[u'销量'] < 5000)] #过滤异常数据
    8. statistics = data.describe() #保存基本统计量
    9. statistics.loc['range'] = statistics.loc['max']-statistics.loc['min'] #极差
    10. statistics.loc['var'] = statistics.loc['std']/statistics.loc['mean'] #变异系数
    11. statistics.loc['dis'] = statistics.loc['75%']-statistics.loc['25%'] #四分位数间距
    12. print(statistics)