189 8069 5689

python实现检验33品种数据是否是正态分布-创新互联

我就废话不多说了,直接上代码吧!

创新互联成都网站建设按需定制,是成都网站营销公司,为成都混凝土搅拌站提供网站建设服务,有成熟的网站定制合作流程,提供网站定制设计服务:原型图制作、网站创意设计、前端HTML5制作、后台程序开发等。成都网站建设热线:13518219792
# -*- coding: utf-8 -*-
"""
Created on Thu Jun 22 17:03:16 2017
@author: yunjinqi 
 
E-mail:yunjinqi@qq.com 
 
Differentiate yourself in the world from anyone else.
"""
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import statsmodels.tsa.stattools as ts
import statsmodels.api as sm
from statsmodels.graphics.api import qqplot
from statsmodels.sandbox.stats.runs import runstest_1samp
import scipy.stats as sts 
 
namelist=['cu','al','zn','pb','sn','au','ag','rb','hc','bu','ru','m9','y9','a9',
    'p9','c9','cs','jd','l9','v9','pp','j9','jm','i9','sr','cf',
    'zc','fg','ta','ma','oi','rm','sm']
j=0
for i in namelist:
 
 filename='C:/Users/HXWD/Desktop/数据/'+i+'.csv'
 data=pd.read_csv(filename,encoding='gbk')
 data.columns=['date','open','high','low','close','amt','opi']
 data.head()
 data=np.log(data['close'])
 r=data-data.shift(1)
 r=r.dropna()
 #print(r)
 rate = np.array(list(r))
 print('品种{}数据长度{}均值{}标准差{}方差{}偏度{}峰度{}'.format(i,len(rate),
   rate.mean(),rate.std(),rate.var(),sts.skew(rate),
   sts.kurtosis(rate)))

本文题目:python实现检验33品种数据是否是正态分布-创新互联
分享网址:http://cdxtjz.cn/article/dggoss.html

其他资讯