22 lines
876 B
Python
22 lines
876 B
Python
#!/usr/bin/env python3
|
|
# -*- coding: utf-8 -*-
|
|
import json, collections
|
|
d = json.load(open('/tmp/wx_juaner.json'))
|
|
recs = d['records']
|
|
def fp(s): return float(s)
|
|
|
|
# 中性记录(收/支='/')
|
|
print("=== 中性交易 17笔 ===")
|
|
nz = [r for r in recs if r[4].strip() == '/']
|
|
for r in nz:
|
|
print(f" {r[0][:16]} {r[1].strip():6s} {r[2]:16s} {r[3][:25]:25s} ¥{fp(r[5])}")
|
|
print()
|
|
# 支出中当前状态非支付成功(退款/关闭)
|
|
st = collections.Counter(r[7].strip() for r in recs if r[4].strip() == '支出')
|
|
print("=== 支出-当前状态 分布 ===", dict(st))
|
|
st_inc = collections.Counter(r[7].strip() for r in recs if r[4].strip() == '收入')
|
|
print("=== 收入-当前状态 分布 ===", dict(st_inc))
|
|
# 收入明细类型
|
|
inc_types = collections.Counter(r[1].strip() for r in recs if r[4].strip() == '收入')
|
|
print("=== 收入-交易类型 ===", dict(inc_types))
|