一个用于解析财务报表的 Python 包
Project description
Financial Report Parser
一个用于解析财务报表的 Python 包,支持从 PDF 文件中提取和分析财务数据。
功能特性
- 📄 PDF 解析: 使用 pdfplumber 解析财务报表 PDF 文件
- 📊 表格识别: 自动识别资产负债表、利润表、现金流量表
- 🔍 数据提取: 提取关键财务指标和数值
- ✅ 数据校验: 提供字段完整性检查
- 📈 JSON 输出: 将解析结果输出为结构化 JSON 数据
- 🖥️ 命令行工具: 提供便捷的命令行接口
安装
pip install financial-report-parser
快速开始
命令行使用
# 解析 PDF 文件
financial-parser parse financial_report.pdf
# 输出到 JSON 文件
financial-parser parse financial_report.pdf --output result.json
Python API 使用
from financial_report_parser import FinancialReportParser, read_pdf_file
# 创建解析器实例
parser = FinancialReportParser()
# 读取 PDF 文件
pdf_content = read_pdf_file("financial_report.pdf")
# 解析财务数据
result = parser.parse_pdf(pdf_content)
# 查看解析结果
print(result)
支持的财务表格
资产负债表
- 货币资金
- 应收账款
- 存货
- 固定资产
- 应付账款
- 股本
- 未分配利润
- 盈余公积
利润表
- 营业收入
- 营业成本
- 营业利润
- 利润总额
- 净利润
现金流量表
- 经营活动现金流量净额
- 投资活动现金流量净额
- 筹资活动现金流量净额
- 现金及现金等价物净增加额
输出格式
解析结果包含以下信息:
{
"content_size": 1096757,
"file_type": "PDF",
"status": "success",
"total_pages": 161,
"pages": [
{
"page_number": 1,
"text": "财务报表内容...",
"tables": [...],
"width": 595.3,
"height": 841.9
}
],
"report_json": {
"balance_sheet": {...},
"profit_statement": {...},
"cash_flow_statement": {...}
}
}
数据校验
包内置数据校验功能,检查:
- 字段完整性
- 数据质量评分
- 校验结果包含错误和警告信息
系统要求
- Python >= 3.9
- pdfplumber >= 0.11.7
开发
安装开发依赖
# 克隆仓库
git clone <repository-url>
cd financial-report-parser
# 安装 Poetry
pip install poetry
# 安装依赖
poetry install
运行测试
python financial_report_parser/test.py
许可证
MIT License
作者
- tless - tlessss@aliyun.com
贡献
欢迎提交 Issue 和 Pull Request!
更新日志
v0.1.0
- 初始版本发布
- 支持 PDF 财务报表解析
- 提供命令行工具和 Python API
- 内置数据校验功能
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
financial_report_parser-0.1.0.tar.gz
(919.7 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file financial_report_parser-0.1.0.tar.gz.
File metadata
- Download URL: financial_report_parser-0.1.0.tar.gz
- Upload date:
- Size: 919.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.9.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
947ba32140df4bcf62f5e42b082b113406b2a9adad20205572fbeac9828924e7
|
|
| MD5 |
d492fc3f63fc0ac80fde811b88a3fb1c
|
|
| BLAKE2b-256 |
c7ad9fe93222afeb530b93e8bfd3ec6de91acb0c482c1ce28d1c74421711323c
|
File details
Details for the file financial_report_parser-0.1.0-py3-none-any.whl.
File metadata
- Download URL: financial_report_parser-0.1.0-py3-none-any.whl
- Upload date:
- Size: 923.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.9.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
707388fad152f281e587da781bd68f4c62f3e579ee56edf85d6f339c8daa4485
|
|
| MD5 |
627a859f706484202ca0d79a808b64c1
|
|
| BLAKE2b-256 |
05f37ec15eda885f4e23cf039fc3c4f278d324c4bd3a0cff8a7c99790f5940c0
|