重庆分公司,新征程启航

为企业提供网站建设、域名注册、服务器等服务

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://cqcxhl.cn/article/dggoss.html

其他资讯

在线咨询
服务热线
服务热线:028-86922220
TOP