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:命令行
打开命令行输入:
jk_contract [input路径(如:'/Users/andy/Desktop/work/ubiquant/合同提取/所有合同')] [output路径(如:/Users/andy/Desktop/work/ubiquant/合同提取/output.xlsx)] [章节(如:基金的投资)] [小节(如:投资范围 投资限制)(注:小节可以多于一个)]
Metadata
Release files for jk-contract 1.1.5
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| jk_contract-1.1.5.tar.gz | 11.8 kB | Without provenance | Details for jk_contract-1.1.5.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| jk_contract-1.1.5-py3-none-any.whl | Python 3 | none | any | Details for jk_contract-1.1.5-py3-none-any.whl |
Total release size: 22.3 kB
Release files / jk_contract-1.1.5.tar.gz
| Download URL | jk_contract-1.1.5.tar.gz |
|---|---|
| Size | 11.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
53ce5f7e2d051430eb1a3d4cfcaf569996c8459116a0764dc802947950f5cd7a
|
|
BLAKE2b-256 checksum How to use checksums |
40cb9b871ec52703a86cdfe8ff04fedf4b7d0fa4021ab9b80b958f2d6fd212ca
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.10.5
|
Release files / jk_contract-1.1.5-py3-none-any.whl
| Download URL | jk_contract-1.1.5-py3-none-any.whl |
|---|---|
| Size | 10.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
6731b059035cccdbcd34ad92ed60605cc918bc3fe8323e19145d2fc45e8e303f
|
|
BLAKE2b-256 checksum How to use checksums |
7776a0fcfe94e4ae4af47a7321242c42cee1652e496459e7fa1d9ca9935bc9ea
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.10.5
|
Security for jk-contract 1.1.5
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.