![](https://img-blog.csdnimg.cn/20201014180756927.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
Python
飞鸽传说
飞鸽传说
展开
-
Python 判断变量的数据类型
import types aaa = 0 print type(aaa) if type(aaa) is types.IntType: print "the type of aaa is int" if isinstance(aaa,int): print "the type of aaa is int"原创 2017-02-18 13:00:22 · 452 阅读 · 0 评论 -
Python 字符串操作(string替换、删除、截取、复制、连接、比较、查找、包含、大小写转换、分割等)
去空格及特殊符号s.strip().lstrip().rstrip(‘,’)复制字符串strcpy(sStr1,sStr2)sStr1 = ‘strcpy’ sStr2 = sStr1 sStr1 = ‘strcpy2’ print sStr2连接字符串strcat(sStr1,sStr2)sStr1 = ‘strcat’ sStr2 = ‘append’ sStr1 += sStr2转载 2017-07-24 11:31:31 · 236 阅读 · 0 评论 -
[python]解析通达信盘后数据获取历史日线数据
转自:http://bbs.pinggu.org/forum.php?mod=viewthread&tid=4804415&page=1平时我们在做 离线的模型 回溯测试时候,需要历史的k线数据。 可是通达信 的日线数据如下: 日线数据在通达信的安装目录: vipdoc\sh\lday 下面本地的通达信 是没有开放api和外部的 自己的交易回溯测试 工具或框架 进行交互的。虽然 我们也可以转载 2017-07-19 23:05:27 · 2971 阅读 · 0 评论 -
python给定起始和结束日期,如何得到中间所有日期
import datetime start='2016-06-01' end='2017-01-01' datestart=datetime.datetime.strptime(start,'%Y-%m-%d') dateend=datetime.datetime.strptime(end,'%Y-%m-%d') while datestart<dateend: date转载 2017-07-18 22:29:46 · 2271 阅读 · 0 评论 -
Python 通配符删除文件
# -*- coding: utf-8 -*-"""使用通配符,获取所有文件,或进行操作。"""import globimport osdef files(curr_dir = '.', ext = '*.exe'): """当前目录下的文件""" for i in glob.glob(os.path.join(curr_dir, ext)): yield转载 2017-07-18 22:22:53 · 8500 阅读 · 0 评论 -
Pandas速查手册中文版
本文翻译自文章: Pandas Cheat Sheet - Python for Data Science,同时添加了部分注解。对于数据科学家,无论是数据分析还是数据挖掘来说,Pandas是一个非常重要的Python包。它不仅提供了很多方法,使得数据处理非常简单,同时在数据处理速度上也做了很多优化,使得和Python内置方法相比时有了很大的优势。如果你想学习Pandas,建议先看两个网站。(1)官网转载 2017-07-18 09:57:11 · 640 阅读 · 0 评论 -
【Python开发】matplotlib绘图不显示问题解决plt.show()
最近在看《Python数据分析》这本书,而自己写代码一直用的是Pycharm,在练习的时候就碰到了plot()绘图不能显示出来的问题。网上翻了一下找到知乎上一篇回答,试了一下好像不行,而且答住提供的“from pylab import *”的方法也不太符合编程规范,最后在Stackoverflow找到了想要的答案,特在此分析一下给大家:以下是有问题的代码,不能绘图成功:import pandas a转载 2017-07-16 22:02:19 · 2005 阅读 · 0 评论 -
python在pandas.DataFrame添加一行
from pandas import * from random import * df = DataFrame(columns=('lib', 'qty1', 'qty2'))#生成空的pandas表 for i in range(5):#插入一行<span id="transmark" style="display: none; width: 0px; hei转载 2017-07-20 11:02:22 · 1472 阅读 · 0 评论 -
cx_Oracle 模块如何安装
➜ ~ pip install cx_Oracle –allow-external cx_Oracle –allow-unverified cx_Oracle Downloading/unpacking cx-Oracle Downloading cx_Oracle-5.1.3.tar.gz (104kB): 104kB downloaded Running setup.py (path:/p原创 2017-04-04 15:11:05 · 2026 阅读 · 0 评论 -
Python日期的加减等操作
Python日期的加减等操作 1. 日期输出格式化所有日期、时间的api都在datetime模块内。datetime => stringnow = datetime.datetime.now() now.strftime(‘%Y-%m-%d %H:%M:%S’)输出2012-03-05 16:26:23.870105strftime是datetime类的实例方法。string => dat转载 2017-07-28 10:27:06 · 1079 阅读 · 0 评论