金融量化学习---Python, MySQL, Pandas

这里用来记录一些在金融领域,尤其是银行相关的资金、债券、票据中应用到的数据管理与分析, 编程等心得或笔记,以及个人的一点小小兴趣(易经八卦、藏密禅修)等

导航

< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5

统计

随笔分类 -  Python应用

主要是Python在金融领域的应用问题
python 的“类”的应用
摘要:#一、介绍: 类与实例 类(Class): 用来描述具有相同的属性和方法的对象的集合。它定义了该集合中每个对象所共有的属性和方法。对象是类的实例。 类变量:类变量在整个实例化的对象中是公用的。类变量定义在类中且在函数体之外。类变量通常不作为实例变量使用。 数据成员:类变量或者实例变量用于处理类及其实 阅读全文

posted @ 2021-02-07 16:53 chengjon 阅读(947) 评论(0) 推荐(0) 编辑

Numpy 数值/数组计算
摘要:import numpy as np ##数组 array的创建 |功能|输入|输出| | | | | |创建一维数组|np.array([1,2,3],dtype=float)|array([1., 2., 3.])| |创建二维数组|np.array([[1,2,3],[3,5,1]],dtyp 阅读全文

posted @ 2021-01-08 09:23 chengjon 阅读(263) 评论(0) 推荐(0) 编辑

python绘图专题(matplotlib,Pandas DataFrame)
摘要:##Matplotlib绘图 user guide: https://matplotlib.org/users/index.html 官方教程:https://www.matplotlib.org.cn/tutorials/ 其它教程:https://www.runoob.com/w3cnote/m 阅读全文

posted @ 2021-01-07 16:05 chengjon 阅读(793) 评论(0) 推荐(0) 编辑

导入excel,csv的N种方式
摘要:方法一:将表中的某一列按str/date读入 file_path = r'F:\Data Store\20089交易清单' file_name ='RB30A1-0900042.xls' df = pd.read_excel(file_path +'\\'+ file_name, dtype={'交 阅读全文

posted @ 2021-01-05 16:03 chengjon 阅读(617) 评论(0) 推荐(0) 编辑

Python格式化函数 format()
摘要:format在python2.6 之后引入,替代了原先的 %,显得更加优雅 format函数是一种格式化输出字符串的函数(str.format), 基本语法是通过 和 : 来代替以前的% 中可以填写后面元组中的下标 也可以填写后面的字段名 % 需要知道替换字符的类型,format则不需要 格式化字符 阅读全文

posted @ 2021-01-05 11:39 chengjon 阅读(542) 评论(0) 推荐(0) 编辑

用python打开文件夹的三种方式
摘要:一、利用explorer.exe import os # 利用explorer.exe执行 start_directory = r'C:\代码\软件包' os.system("explorer.exe %s" % start_directory) 二、用os.startfile import os 阅读全文

posted @ 2021-01-05 09:44 chengjon 阅读(1958) 评论(1) 推荐(1) 编辑

认识--类 ( Class ) 面向对象技术
摘要:类(Class): 用来描述具有相同的属性和方法的对象的集合。它定义了该集合中每个对象所共有的属性和方法。对象是类的实例。 类变量:类变量在整个实例化的对象中是公用的。类变量定义在类中且在函数体之外。类变量通常不作为实例变量使用。 数据成员:类变量或者实例变量, 用于处理类及其实例对象的相关的数据。 阅读全文

posted @ 2020-12-04 17:19 chengjon 阅读(241) 评论(0) 推荐(0) 编辑

python 平均值/MAX/MIN值 计算从入门到精通
摘要:##入门级计算 ####1、算数平均值 #样本: S = [s1, s2, s3, …, sn] #算术平均值: m = (s1 + s2 + s3 + … + sn)/n Numpy中的写法 m = numpy.mean(样本数组) ####2、加权平均值 #样本: S = [s1, s2, s3 阅读全文

posted @ 2020-12-02 09:38 chengjon 阅读(1733) 评论(0) 推荐(0) 编辑

python读写word文档 -- python-docx从入门到精通
摘要:两种安装方式: pip install python-docx conda install -c conda-forge python-docx 常用到的导入命令: import docx from docx import Document from docx.shared import Pt,Cm 阅读全文

posted @ 2020-11-25 17:07 chengjon 阅读(4214) 评论(0) 推荐(0) 编辑

python中的简易表格prettytable
摘要:安装:pip install PrettyTable ##普通表格 from prettytable import PrettyTable table = PrettyTable(['编号','云编号','名称','IP地址']) table.add_row(['1','server01','服务器 阅读全文

posted @ 2020-11-20 14:11 chengjon 阅读(765) 评论(0) 推荐(0) 编辑

ubuntu中安装和使用quant-lib
摘要:安装与使用 推荐在 Ubuntu 操作系统下安装和使用 QuantLib ,如果使用的是 Ubuntu 16.04 或 18.04,请先在系统中添加 Dirk Eddelbuettel 维护的 PPA,以便轻松地安装最新版本。 sudo add-apt-repository ppa:edd/misc 阅读全文

posted @ 2020-11-14 00:13 chengjon 阅读(263) 评论(0) 推荐(0) 编辑

python虚拟环境设置
摘要:目录Ubuntu命令行下使用虚拟环境conda下建立虚拟环境env 命令列表spyder中切换环境spyder中切换python版本vscode中切换环境vscode中切换python版本conda 下proxy 的设置查看现有代理设置设置 proxy有两种方式,第一种,conda config - 阅读全文

posted @ 2020-11-10 10:11 chengjon 阅读(22455) 评论(1) 推荐(1) 编辑

openpyxl 安装失败的处理 (缺少 et_xmlfile )
摘要:安装 openpyxl 需要 jdcal & et_xmlfile 这两个模块。 可以先去下载: https://pypi.org/ 下载了tar.gz文件后, 放在 C:\Users(你的名字)这个目录下 然后运行: pip install jdcal (全名), OK 再安装 et_xmlfil 阅读全文

posted @ 2020-11-09 21:13 chengjon 阅读(4620) 评论(0) 推荐(1) 编辑

python相关之手工安装
摘要:#手工安装python 我并不想手工安装,但是没办法,办公机不让打开exe文件,我只能下zip,来自己手动安装 1。下载地址:https://www.python.org/downloads/ 把下载的文件解压到一个目录中去。 然后打开cmd 进入该目录(注意如果因为空格进不去,可以用 cd "/P 阅读全文

posted @ 2020-11-09 11:39 chengjon 阅读(426) 评论(2) 推荐(0) 编辑

python下的数据拼接
摘要:使用pandas拼接 ##1. pd.merge() 功能:用于通过一个或多个键将两个数据集的行连接起来,类似于 SQL 中的 JOIN。 语法如下: merge(left, right, how='inner', on=None, left_on=None, right_on=None, left 阅读全文

posted @ 2020-11-02 18:09 chengjon 阅读(1833) 评论(0) 推荐(0) 编辑

Date运算之二 --- pandas中的日期运算
摘要:##日期获取 pandas读取excel文件时指定列的格式 import pandas as pd file_name ='RB30A1.xlsx' jsh_list =pd.read_excel(file_name, dtype={'交易编号':str,'交易日期':'datetime64'},h 阅读全文

posted @ 2020-11-02 09:32 chengjon 阅读(2611) 评论(0) 推荐(0) 编辑

Date运算之一 -- datetime 相关及str转date等运算
摘要:python 中 date与str转化及date之间的运算 [TOC] #获取当前日期 ## 获取今天(现在时间) ``` import datetime # 创建日期对象 date = datetime.date(2023, 6, 11) print(date) # 2023-06-11 # 创建 阅读全文

posted @ 2020-10-27 17:08 chengjon 阅读(6702) 评论(0) 推荐(0) 编辑

好用的python项目
摘要:目录数据分析NumpyPandasydata金融计算quant-libpyfinanceDROPpyfoliofinancepypyportfolioopt 资产组合优化TA-Lib文本图形Graphviz 绘制关系图python-docx 和 docxtplpyechartspdfplumbert 阅读全文

posted @ 2020-10-27 09:26 chengjon 阅读(1480) 评论(0) 推荐(0) 编辑

数据分析项目-金融行业案例
摘要:https://www.jianshu.com/p/41e39989d0f2 阅读全文

posted @ 2020-10-22 13:16 chengjon 阅读(465) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示