Skip to main content

Toolkit with functions designed to extract various information from JK contracts

Project description

jk_contract 提取合同章节、小节、首页、风险级别

暂时不支持广发

安装方法

命令行输入pip install jk_contract

创建新的.py文件,输入:

-*- coding: GBK -*-

import jk_contract as jk

函数

单个合同文件

contract = jk.Contract('[合同文件路径]')

print(contract.get_risk_level() # 输出风险等级)

print(contract.get_chapter('[章节(如:基金的投资)]' # 输出章节内容)

print(contract.get_section_of_chapter('[章节]', '[小节(如:投资限制、投资范围)]' #输出小节内容)

多个合同文件

contracts = jk.Contracts('合同文件夹路径')

提取内容可以是章节或者章节内小节:

content = contracts.get_chapters('[章节]')

content = contracts.get_sections('[章节]', '[小节]') #若提取多于一个小节,[小节]需要为list(参照使用案例)

将提取内容以基金产品名字作为index生成dataframe:

df = contracts.get_df(content)

最后将df导出成excel:

contracts.to_excel(df, '[导出路径]+[导出excel文件名称].xlsx')

举例:

contracts.to_excel(df, '~/Desktop/output.xlsx')

使用案例(提取投资限制和投资范围)

方法1:创建新python文件
# -*- coding: GBK -*-

import jk_contract as jk

contracts = jk.Contracts('/Users/andy/Desktop/work/ubiquant/合同提取/所有合同')
contents = contracts.get_sections('基金的投资', ['投资限制', '投资范围'])
contracts.to_excel(contracts.get_df(contents), '~/Desktop/output.xlsx')
方法2:命令行

打开命令行输入:

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

jk_contract-1.0.2.tar.gz (10.6 kB view details)

Uploaded Source

Built Distribution

jk_contract-1.0.2-py3-none-any.whl (9.3 kB view details)

Uploaded Python 3

File details

Details for the file jk_contract-1.0.2.tar.gz.

File metadata

  • Download URL: jk_contract-1.0.2.tar.gz
  • Upload date:
  • Size: 10.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.5

File hashes

Hashes for jk_contract-1.0.2.tar.gz
Algorithm Hash digest
SHA256 180e70cbf3441dc2cc620a5c1408c2189e966e7bccd011001fdd07ac302a9c1c
MD5 e74064b3bb4f5e055a8142f644749db1
BLAKE2b-256 36837cc8e8f273367660bb94e6495649cb5943e89adcd1f4382f6ef1237f90c4

See more details on using hashes here.

File details

Details for the file jk_contract-1.0.2-py3-none-any.whl.

File metadata

  • Download URL: jk_contract-1.0.2-py3-none-any.whl
  • Upload date:
  • Size: 9.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.5

File hashes

Hashes for jk_contract-1.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 072f2c77cb5bb86c30dd040adcf61c472b9391460290accea7666435572023cb
MD5 8ea3b8dd7ca66a0b5bd3888673a68263
BLAKE2b-256 58814737b28410a5ebd72c41546a57fd65713a0307681561cae8352b2890d575

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page