中级
生成银行账户月度对账单
未完成
中级参考
代码结构已给出,请填写 ____ 处
def solve():
from pyodide.http import open_url
customers_csv = open_url(____).read()
accounts_csv = open_url(____).read()
cards_csv = open_url(____).read()
transactions_csv = open_url(____).read()
transfers_csv = open_url(____).read()
risk_rules_csv = open_url(____).read()
import sqlite3
import pandas as pd
from io import StringIO
conn = sqlite3.connect(____)
pd.read_csv(StringIO(____)).to_sql(____)
pd.read_csv(StringIO(____)).to_sql(____)
txns = pd.read_sql_query(____)
print(____)
print(txns.to_string(____))
income = txns[txns['____'].isin(____)]['____'].sum()
expense = txns[txns['____'].isin(____)]['____'].sum()
opening = txns.iloc[____]['____'] - txns.iloc[____]['____'] if txns.iloc[____]['____']=='____' else txns.iloc[____]['____'] + txns.iloc[____]['____']
closing = txns.iloc[-____]['____']
print(____)
print(____)
print(____)
conn.close()
示例
输入
solve()
期望输出
=== 2025-04 对账单(账户1)===
date type amount balance_after
2025-04-01 deposit 5000.0 20230.5
2025-04-02 withdraw 1500.0 18730.5
2025-04-12 consume 800.0 17930.5
2025-04-15 consume 1200.0 16730.5
2025-04-30 interest 2000.0 18730.5
收入合计: 7000.00
支出合计: 3500.00
期末余额: 18730.50
👑
升级 VIP
解锁全部题目,畅通无阻地学习
- ✓ 解锁全部训练包所有题目
- ✓ 查看完整参考代码和提示
- ✓ 浏览器内直接运行 Python 代码
- ✓ 自动批改 + 进度追踪
30天
¥18
1年
¥99
2年
¥158
3年
¥199