摘要: #线性回归最小二乘法 from sklearn import linear_model import sys import tushare as ts import matplotlib.pyplot as plt import pandas as pd import sklearn.metrics 阅读全文
posted @ 2018-07-08 22:05 The_Chain 阅读(216) 评论(0) 推荐(0) 编辑
摘要: #数据预处理方法,主要是处理数据的量纲和同趋势化问题。 import numpy as np from sklearn import preprocessing #零均值规范 data=np.random.rand(3,4)#随机生成3行4列的数据 data_standardized=preproc 阅读全文
posted @ 2018-07-08 18:00 The_Chain 阅读(280) 评论(0) 推荐(0) 编辑
摘要: import tushare as ts import pandas as pd import numpy as np import matplotlib.pyplot as plt from scipy import stats import statsmodels.api as sm #资产定价 阅读全文
posted @ 2018-07-07 15:04 The_Chain 阅读(996) 评论(0) 推荐(0) 编辑
摘要: 表格:data 时间 金额 2015-01-01 10000 2015-01-02 20000 2015-01-03 30000 select a.时间,sum(b.金额) as 累计金额 from data a,data b where a.时间>=b.时间 group by a.时间 阅读全文
posted @ 2018-07-05 13:59 The_Chain 阅读(363) 评论(0) 推荐(0) 编辑
摘要: pip install arch from arch import arch_model import tushare as ts import pandas as pd import numpy as np sh=ts.get_hist_data('sh').sort_index() sh['re 阅读全文
posted @ 2018-07-04 16:18 The_Chain 阅读(8783) 评论(0) 推荐(0) 编辑
摘要: import numpy as np s=np.array([[1,2,3],[4,5,6]],np.int32)#相当于list的嵌套 s.shape#数据的分布状况 s.dtype#数据类型 type(s)#s的类型 s[0]#取出第一行或者任意行 s[:,0]#取任意列 s[0,1]#取出任意 阅读全文
posted @ 2018-07-03 18:47 The_Chain 阅读(153) 评论(0) 推荐(0) 编辑
摘要: import math math.pi #圆周率 math.e #指数 math.sin(2*math.pi/180)#正弦函数 math.sqrt()#平方根求解 math.log(值,底数)#求解对数 math.exp()#求解指数函数 阅读全文
posted @ 2018-07-03 15:31 The_Chain 阅读(117) 评论(0) 推荐(0) 编辑
摘要: d={'name':'chain','age':19,'gender':'female'}#创建字典 按照 键:值 的格式创建 d['name']#按照键来取值 d['age']+=1 #给年龄加1 d={'boss':{'fristname':'xiong','age':54},'manger': 阅读全文
posted @ 2018-07-03 15:16 The_Chain 阅读(120) 评论(0) 推荐(0) 编辑
摘要: l=['ab','acv','ad']#创建列表 len(l) #列表元素个数 l[0]#取出第一个元素 l[:-1]#取出除最后一个的元素 l[0:2]#取出的数据是左开右闭区间 l[0].upper()#大写 l[1].lower()#小写 l[0].capitalize()#首字母大写 l[0 阅读全文
posted @ 2018-07-03 14:18 The_Chain 阅读(225) 评论(0) 推荐(0) 编辑
摘要: import tushare as ts import pandas as pd import numpy as np import matplotlib.pyplot as plt from scipy import stats sh=ts.get_hist_data('sh') stats.pr 阅读全文
posted @ 2018-07-02 09:45 The_Chain 阅读(1367) 评论(0) 推荐(0) 编辑