csdn的一次回答问题
#coding:utf8
import tushare as ts
import pandas as pd
import numpy as np
import pymysql,datetime
import matplotlib.pyplot as plt
import logging
import sys ,requests,re def init_env():
# token='23b817c8b6e2b772f37ad6f5628ad348a0aefed07ed9b07ecc75976d'
# db=pymysql.connect(host='127.0.0.1',db='stock',user='root',passwd='root',charset='utf8')
# cursor=db.cursor() # pro=ts.pro_api(token)
aa=1
return aa
# #初始化db,tushare token
# db,cursor,pro=init_env() #coding=utf-8 duan ="--------------------------" #在控制台断行区别的 if __name__ == "__main__": nump_array_date = ['20170808210000' ,'20170808210100' ,'20170808210200' ,'20170808210300'
,'20170808210400' ,'20170808210500' ,'20170808210600' ,'20170808210700'
,'20170808210800' ,'20170808210900' ,'20170808211000' ,'20170808211100'
,'20170808211200' ,'20170808211300' ,'20170808211400' ,'20170808211500'
,'20170808211600' ,'20170808211700' ,'20170808211800' ,'20170808211900'
,'20170808212000' ,'20170808212100' ,'20170808212200' ,'20170808212300'
,'20170808212400' ,'20170808212500' ,'20170808212600' ,'20170808212700'
,'20170808212800' ,'20170808212900' ,'20170808213000' ,'20170808213100'
,'20170808213200' ,'20170808213300' ,'20170808213400' ,'20170808213500'
,'20170808213600' ,'20170808213700' ,'20170808213800' ,'20170808213900'
,'20170808214000' ,'20170808214100' ,'20170808214200' ,'20170808214300'
,'20170808214400' ,'20170808214500' ,'20170808214600' ,'20170808214700'
,'20170808214800' ,'20170808214900' ,'20170808215000' ,'20170808215100'
,'20170808215200' ,'20170808215300' ,'20170808215400' ,'20170808215500'
,'20170808215600' ,'20170808215700' ,'20170808215800' ,'20170808215900'
,'20170808220000' ,'20170808220100' ,'20170808220200' ,'20170808220300'
,'20170808220400' ,'20170808220500' ,'20170808220600' ,'20170808220700'
,'20170808220800' ,'20170808220900' ,'20170808221000' ,'20170808221100'
,'20170808221200' ,'20170808221300' ,'20170808221400' ,'20170808221500'
,'20170808221600' ,'20170808221700' ,'20170808221800' ,'20170808221900'
,'20170808222000' ,'20170808222100' ,'20170808222200' ,'20170808222300'
,'20170808222400' ,'20170808222500' ,'20170808222600' ,'20170808222700'
,'20170808222800' ,'20170808222900' ,'20170808223000' ,'20170808223100'
,'20170808223200' ,'20170808223300' ,'20170808223400' ,'20170808223500'
,'20170808223600' ,'20170808223700' ,'20170808223800' ,'20170808223900'
,'20170808224000' ,'20170808224100' ,'20170808224200' ,'20170808224300'
,'20170808224400' ,'20170808224500' ,'20170808224600' ,'20170808224700'
,'20170808224800' ,'20170808224900' ,'20170808225000' ,'20170808225100'
,'20170808225200' ,'20170808225300' ,'20170808225400' ,'20170808225500'
,'20170808225600' ,'20170808225700' ,'20170808225800' ,'20170808225900'
,'20170808230000' ,'20170809090000' ,'20170809090100' ,'20170809090200'
,'20170809090300' ,'20170809090400' ,'20170809090500' ,'20170809090600'
,'20170809090700' ,'20170809090800' ,'20170809090900' ,'20170809091000'
,'20170809091100' ,'20170809091200' ,'20170809091300' ,'20170809091400'
,'20170809091500' ,'20170809091600' ,'20170809091700' ,'20170809091800'
,'20170809091900' ,'20170809092000' ,'20170809092100' ,'20170809092200'
,'20170809092300' ,'20170809092400' ,'20170809092500' ,'20170809092600'
,'20170809092700' ,'20170809092800' ,'20170809092900' ,'20170809093000'
,'20170809093100' ,'20170809093200' ,'20170809093300' ,'20170809093400'
,'20170809093500' ,'20170809093600' ,'20170809093700' ,'20170809093800'
,'20170809093900' ,'20170809094000' ,'20170809094100' ,'20170809094200'
,'20170809094300' ,'20170809094400' ,'20170809094500' ,'20170809094600'
,'20170809094700' ,'20170809094800' ,'20170809094900' ,'20170809095000'
,'20170809095100' ,'20170809095200' ,'20170809095300' ,'20170809095400'
,'20170809095500' ,'20170809095600' ,'20170809095700' ,'20170809095800'
,'20170809095900' ,'20170809100000' ,'20170809100100' ,'20170809100200'
,'20170809100300' ,'20170809100400' ,'20170809100500' ,'20170809100600'
,'20170809100700' ,'20170809100800' ,'20170809100900' ,'20170809101000'
,'20170809101100' ,'20170809101200' ,'20170809101300' ,'20170809101400'
,'20170809103000' ,'20170809103100' ,'20170809103200' ,'20170809103300'
,'20170809103400' ,'20170809103500' ,'20170809103600' ,'20170809103700'
,'20170809103800' ,'20170809103900' ,'20170809104000' ,'20170809104100'
,'20170809104200' ,'20170809104300' ,'20170809104400' ,'20170809104500'
,'20170809104600' ,'20170809104700' ,'20170809104800' ,'20170809104900'
,'20170809105000' ,'20170809105100' ,'20170809105200' ,'20170809105300'
,'20170809105400' ,'20170809105500' ,'20170809105600' ,'20170809105700'
,'20170809105800' ,'20170809105900' ,'20170809110000' ,'20170809110100'
,'20170809110200' ,'20170809110300' ,'20170809110400' ,'20170809110500'
,'20170809110600' ,'20170809110700' ,'20170809110800' ,'20170809110900'
,'20170809111000' ,'20170809111100' ,'20170809111200' ,'20170809111300'
,'20170809111400' ,'20170809111500' ,'20170809111600' ,'20170809111700'
,'20170809111800' ,'20170809111900' ,'20170809112000' ,'20170809112100'
,'20170809112200' ,'20170809112300' ,'20170809112400' ,'20170809112500'
,'20170809112600' ,'20170809112700' ,'20170809112800' ,'20170809112900'
,'20170809133000' ,'20170809133100' ,'20170809133200' ,'20170809133300'
,'20170809133400' ,'20170809133500' ,'20170809133600' ,'20170809133700'
,'20170809133800' ,'20170809133900' ,'20170809134000' ,'20170809134100'
,'20170809134200' ,'20170809134300' ,'20170809134400' ,'20170809134500'
,'20170809134600' ,'20170809134700' ,'20170809134800' ,'20170809134900'
,'20170809135000' ,'20170809135100' ,'20170809135200' ,'20170809135300'
,'20170809135400' ,'20170809135500' ,'20170809135600' ,'20170809135700'
,'20170809135800' ,'20170809135900' ,'20170809140000' ,'20170809140100'
,'20170809140200' ,'20170809140300' ,'20170809140400' ,'20170809140500'
,'20170809140600' ,'20170809140700' ,'20170809140800' ,'20170809140900'
,'20170809141000' ,'20170809141100' ,'20170809141200' ,'20170809141300'
,'20170809141400' ,'20170809141500' ,'20170809141600' ,'20170809141700'
,'20170809141800' ,'20170809141900' ,'20170809142000' ,'20170809142100'
,'20170809142200' ,'20170809142300' ,'20170809142400' ,'20170809142500'
,'20170809142600' ,'20170809142700' ,'20170809142800' ,'20170809142900'
,'20170809143000' ,'20170809143100' ,'20170809143200' ,'20170809143300'
,'20170809143400' ,'20170809143500' ,'20170809143600' ,'20170809143700'
,'20170809143800' ,'20170809143900' ,'20170809144000' ,'20170809144100'
,'20170809144200' ,'20170809144300' ,'20170809144400' ,'20170809144500'
,'20170809144600' ,'20170809144700' ,'20170809144800' ,'20170809144900'
,'20170809145000' ,'20170809145100' ,'20170809145200' ,'20170809145300'
,'20170809145400' ,'20170809145500' ,'20170809145600' ,'20170809145700'
,'20170809145800' ,'20170809145900'] nump_array_date= pd.to_datetime(nump_array_date) # convert str to date nump_array_price = [3900.0, 3903.0, 3891.0, 3888.0, 3893.0, 3895.0, 3899.0, 3906.0, 3914.0, 3911.0,
3912.0, 3910.0, 3914.0, 3920.0, 3920.0, 3915.0, 3915.0, 3915.0, 3911.0, 3903.0,
3901.0, 3899.0, 3894.0, 3901.0, 3901.0, 3897.0, 3891.0, 3882.0, 3878.0, 3881.0,
3878.0, 3885.0, 3886.0, 3889.0, 3887.0, 3887.0, 3886.0, 3885.0, 3886.0, 3887.0,
3894.0, 3888.0, 3890.0, 3887.0, 3888.0, 3883.0, 3880.0, 3885.0, 3887.0, 3882.0,
3882.0, 3887.0, 3886.0, 3885.0, 3890.0, 3891.0, 3887.0, 3890.0, 3886.0, 3891.0,
3888.0, 3891.0, 3881.0, 3878.0, 3877.0, 3875.0, 3871.0, 3872.0, 3879.0, 3876.0,
3879.0, 3885.0, 3884.0, 3883.0, 3879.0, 3877.0, 3880.0, 3878.0, 3882.0, 3885.0,
3883.0, 3884.0, 3883.0, 3881.0, 3882.0, 3889.0, 3896.0, 3891.0, 3897.0, 3905.0,
3901.0, 3902.0, 3899.0, 3897.0, 3896.0, 3899.0, 3902.0, 3902.0, 3905.0, 3913.0,
3910.0, 3909.0, 3902.0, 3901.0, 3902.0, 3897.0, 3903.0, 3902.0, 3901.0, 3900.0,
3903.0, 3906.0, 3906.0, 3909.0, 3904.0, 3902.0, 3902.0, 3902.0, 3904.0, 3909.0,
3909.0, 3941.0, 3934.0, 3947.0, 3938.0, 3939.0, 3938.0, 3932.0, 3930.0, 3929.0,
3924.0, 3930.0, 3930.0, 3926.0, 3929.0, 3918.0, 3914.0, 3912.0, 3908.0, 3912.0,
3913.0, 3910.0, 3915.0, 3916.0, 3913.0, 3915.0, 3918.0, 3913.0, 3908.0, 3912.0,
3911.0, 3916.0, 3913.0, 3915.0, 3918.0, 3917.0, 3916.0, 3920.0, 3920.0, 3917.0,
3916.0, 3912.0, 3913.0, 3909.0, 3911.0, 3910.0, 3907.0, 3908.0, 3901.0, 3907.0,
3908.0, 3909.0, 3910.0, 3909.0, 3911.0, 3912.0, 3914.0, 3915.0, 3913.0, 3919.0,
3917.0, 3915.0, 3918.0, 3919.0, 3918.0, 3926.0, 3925.0, 3925.0, 3927.0, 3923.0,
3926.0, 3926.0, 3920.0, 3921.0, 3919.0, 3919.0, 3917.0, 3921.0, 3924.0, 3922.0,
3921.0, 3923.0, 3922.0, 3922.0, 3927.0, 3928.0, 3928.0, 3929.0, 3926.0, 3927.0,
3928.0, 3926.0, 3922.0, 3912.0, 3911.0, 3908.0, 3912.0, 3910.0, 3913.0, 3905.0,
3910.0, 3904.0, 3893.0, 3896.0, 3898.0, 3896.0, 3903.0, 3905.0, 3905.0, 3907.0,
3906.0, 3909.0, 3910.0, 3910.0, 3913.0, 3911.0, 3911.0, 3914.0, 3913.0, 3908.0,
3913.0, 3910.0, 3910.0, 3911.0, 3914.0, 3918.0, 3917.0, 3917.0, 3919.0, 3919.0,
3917.0, 3922.0, 3926.0, 3924.0, 3927.0, 3925.0, 3940.0, 3940.0, 3943.0, 3949.0,
3953.0, 3951.0, 3951.0, 3953.0, 3950.0, 3957.0, 3964.0, 3964.0, 3960.0, 3958.0,
3963.0, 3963.0, 3956.0, 3959.0, 3959.0, 3957.0, 3961.0, 3960.0, 3960.0, 3963.0,
3972.0, 3971.0, 3974.0, 3982.0, 3980.0, 3981.0, 3969.0, 3970.0, 3970.0, 3972.0,
3968.0, 3968.0, 3970.0, 3974.0, 3973.0, 3974.0, 3971.0, 3972.0, 3978.0, 3982.0,
3975.0, 3971.0, 3970.0, 3972.0, 3971.0, 3970.0, 3973.0, 3973.0, 3976.0, 3976.0,
3975.0, 3981.0, 3980.0, 3979.0, 3979.0, 3984.0, 3980.0, 3977.0, 3983.0, 3984.0,
3984.0, 3980.0, 3979.0, 3979.0, 3978.0, 3978.0, 3978.0, 3979.0, 3983.0, 3978.0,
3978.0, 3981.0, 3984.0, 3990.0, 3993.0, 3997.0, 4001.0, 4000.0, 3997.0, 4003.0,
4003.0, 4000.0, 4002.0, 3991.0, 3994.0, 4006.0,] df=pd.DataFrame({'date':nump_array_date,'price':nump_array_price})
df_night=df[df.date<'2017-08-09 09:00:00']
df_0900=df[(df.date>='2017-08-09 09:00:00')&(df.date<='2017-08-09 10:15:00')]
df_1030=df[(df.date>='2017-08-09 10:30:00')&(df.date<='2017-08-09 11:30:00')]
df_1330=df[(df.date>='2017-08-09 13:30:00')&(df.date<='2017-08-09 15:00:00')]
df_all=df_0900.append(df_1030)
df_final=df_all.append(df_1330) x_tk=[]
x_lb=[] for i in range(0,len(df_final.date.tolist())):
x_tk.append(i)
if i % 7==0:
x_lb.append(df_final.date.tolist()[i])
else:
x_lb.append("") plt.plot(x_tk,df_final.price)
plt.xticks(x_tk,(x_lb),rotation=80)
plt.show()
csdn的一次回答问题的更多相关文章
- Java并发1——线程创建、启动、生命周期与线程控制
内容提要: 线程与进程 为什么要使用多线程/进程?线程与进程的区别?线程对比进程的优势?Java中有多进程吗? 线程的创建与启动 线程的创建有哪几种方式?它们之间有什么区别? 线程的生命周期与线程控制 ...
- 【转】js实现复制到剪贴板功能,兼容所有浏览器
两天前听了一个H5的分享,会议上有一句话,非常有感触:不是你不能,而是你对自己的要求太低.很简单的一句话,相信很多事情不是大家做不到,真的是对自己的要求太低,如果对自己要求多一点,那么你取得的进步可能 ...
- float 的有效数字为七位是怎么得出来的
以下内容来自CSDN网友xian_wwq的回答(http://bbs.csdn.net/topics/390874239): float: 1bit(符号位) 8bits(指数位) 23bits( ...
- 为什么开发者热衷在Stack Overflow上查阅API文档?
摘要:一项新研究跟踪了Android开发者的访问历史,发现开发者多达二分之一的文档是从Stack Overflow上获取到的,而Stack Overflow上的示例也多于官方指南,开发者通过搜索更多时 ...
- 关于using namespace std
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~关于using namespace std ~~~~~~~~~~~~~~~~~~~~~~~~~~~ ...
- A标签中传递的中文参数到Servlet 后台request.getParameter()接收时出现中文乱码
package util; import javax.servlet.http.HttpServletRequest;import javax.servlet.http.HttpServletRequ ...
- using namespace std 是什么意思?
摘录CSDN上面大牛的回答简要意思就是使用标准库,想知道更清楚的继续读下面的. using namespace std 意思: using 和namespace都是C++的关键词. ...
- super.onCreate(savedInstanceState) 以及onCreate(Bundle savedInstanceState, PersistableBundle persistentState)
super.onCreate(savedInstanceState) 调用父类的onCreate构造函数. 当一个Activity在生命周期结束前,会调用onSaveInsanceState()这个回 ...
- cas sso 整合记录
首先说明下,我使用的cas-server版本是4.2.1 整合过程中遇到的问题及解决方式如下 1.因为使用https的话证书是个麻烦事,所以启用http 修改cas-server-webapp下的ca ...
随机推荐
- 使用SendMessage进行进程间通信
Imports System.Runtime.InteropServices Public Class Monitor <DllImport("user32.dll", Ch ...
- X86汇编概要
来自:https://www.cnblogs.com/jiftle/p/8453106.html 本文翻译自:http://www.cs.virginia.edu/~evans/cs216/guide ...
- salt之grains组件
grains是saltstack最重要的组件之一,作用是收集被控主机的基本信息,这些信息通常都是一些静态类的数据,包括CPU.内核.操作系统.虚拟化等,在服务器端可以根据这些信息进行灵活定制,管理员可 ...
- Ansible Playbook Variables
虽然自动化存在使得更容易使事情重复,但所有的系统可能不完全一样. 在某些系统上,您可能需要设置一些与其他操作略有不同的行为或配置. 此外,一些观察到的远程系统的行为或状态可能需要影响如何配置这些系统. ...
- mysql基本的修改表的命令
修改表相关的命令 1.添加列表 alter table 表名 add 列名 类型; 2.删除某一列 alter table userinfo drop column 列名; 3.修改列的类型 alte ...
- python之函数(function)
#今天来学习一下函数,function# 定义一个函数的时候,函数不会被执行,只有调用函数,函数才会执行## 定义函数# # 1.def是创建函数的关键字,创建函数# # 2.函数名# # 3.()# ...
- iOS - OC - XML 解析 - NSXMLParser
//4.解析数据 //4.1 创建XML解析器:SAX NSXMLParser *parser = [[NSXMLParser alloc]initWithData:data]; //4.2 设置代理 ...
- OC - GCD 队列组 - 下载图片画图
- (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event{ [self downloadIma ...
- springboot与elasticsearch
1.安装elasticsearch 下载elasticsearch docker pull registry.docker-cn.com/library/elasticsearch 运行elastic ...
- Linux CentOS6.6 NFS服务的配置与安装
一.简介 NFS(Network File System)即网络文件系统,是FreeBSD支持的文件系统中的一种,它允许网络中的计算机之间通过TCP/IP网络共享资源.在NFS的应用中,本地NFS的客 ...