摘要: import tushare as ts import pandas as pd import numpy as np import matplotlib.pyplot as plt #获取万科000002股票日数据 wk=ts.get_hist_data('000002').sort_index( 阅读全文
posted @ 2018-06-30 10:04 The_Chain 阅读(386) 评论(0) 推荐(0) 编辑
摘要: import pandas as pd import numpy as np import tushare as ts import matplotlib.pyplot as plt import seaborn as sns from scipy import stats sh=ts.get_hi 阅读全文
posted @ 2018-06-29 11:00 The_Chain 阅读(2793) 评论(0) 推荐(0) 编辑
摘要: import tushare as ts import pandas as pd import numpy as np from scipy import stats #今天上证跌破2800,计算一下var值 sh=ts.get_hist_data('sh').sort_index() sh['re 阅读全文
posted @ 2018-06-28 15:25 The_Chain 阅读(865) 评论(0) 推荐(0) 编辑
摘要: import tushare as ts import pandas as pd import numpy as np import matplotlib.pyplot as plt import seaborn as sns #绘制线图 plt.plot(数据,label='标签名字',color 阅读全文
posted @ 2018-06-28 10:40 The_Chain 阅读(178) 评论(0) 推荐(0) 编辑
摘要: from datetime import datetime import pandas as pd import numpy as np #生成一个序列数据并转换为DataFrame格式 lasttime=pd.DataFrame(pd.date_range(start='20170101',end 阅读全文
posted @ 2018-06-27 10:04 The_Chain 阅读(1570) 评论(0) 推荐(0) 编辑
摘要: import tushare as ts import pandas as pd import numpy as np import sqlite3 pf=ts.get_hist_data('600848') con=sqlite3.connect('c:\\desktop\\stockdata.d 阅读全文
posted @ 2018-06-24 22:22 The_Chain 阅读(1950) 评论(0) 推荐(0) 编辑
摘要: 创建空dataframe 1,data=pd.DataFrame() 2,data=pd.DataFrame(columns=['a','b','c','d']) 3删除列 data.drop('a',axis=1) #删除行 data.drop([0,1]) #按索引删除 #切片的操作 #选取1列 阅读全文
posted @ 2018-06-24 16:22 The_Chain 阅读(148) 评论(0) 推荐(0) 编辑
摘要: 按索引排序 import tushare as ts import pandas as pd data=ts.get_hist_data('600848') #默认索引升序 data=data.sort_index() #索引降序排序 data=data.sort_index(axis=1,asce 阅读全文
posted @ 2018-06-23 21:36 The_Chain 阅读(912) 评论(0) 推荐(0) 编辑
摘要: enumerate函数 date='20180623' price=['30.45','32.56','36.78','30.32'] date_arrary=[str(date+num) for num,_ in enumerate(price)] 阅读全文
posted @ 2018-06-23 15:45 The_Chain 阅读(97) 评论(0) 推荐(0) 编辑
摘要: pip install tushare #python 3.6 import tushare as ts ,得到上证300指数和个股数据历史价格数据 sh=ts.get_hist_data('sh') **stock=ts.get_hist_data('*******')#输入股票代码即可 阅读全文
posted @ 2018-06-04 16:44 The_Chain 阅读(71) 评论(0) 推荐(0) 编辑