初级
查询某贷款账户的完整还款历史
未完成
初级参考
完整示例代码供参考,建议自己理解后重新输入
def solve():
from pyodide.http import open_url
clients_csv = open_url("https://data.zuihe.com/dbd/credit/state_03/clients.csv").read()
loans_csv = open_url("https://data.zuihe.com/dbd/credit/state_03/loans.csv").read()
loan_repayment_schedule_csv = open_url("https://data.zuihe.com/dbd/credit/state_03/loan_repayment_schedule.csv").read()
loan_transactions_csv = open_url("https://data.zuihe.com/dbd/credit/state_03/loan_transactions.csv").read()
loan_charges_csv = open_url("https://data.zuihe.com/dbd/credit/state_03/loan_charges.csv").read()
import sqlite3, pandas as pd
from io import StringIO
conn = sqlite3.connect(':memory:')
pd.read_csv(StringIO(loan_transactions_csv)).to_sql('loan_transactions', conn, index=False, if_exists='replace')
result = pd.read_sql_query("SELECT tx_date, amount, principal_portion, interest_portion, reference FROM loan_transactions WHERE loan_id=1 AND tx_type='REPAYMENT' ORDER BY tx_date", conn)
print(result.to_string(index=False))
conn.close()
示例
输入
solve()
期望输出
tx_date amount principal_portion interest_portion reference 2026-03-31 4342 3800 542 REP20260301 2026-04-30 4342 3821 521 REP20260401 2026-05-31 4342 3842 500 REP20260501 2026-06-30 4342 3863 479 REP20260601
👑
升级 VIP
解锁全部题目,畅通无阻地学习
- ✓ 解锁全部训练包所有题目
- ✓ 查看完整参考代码和提示
- ✓ 浏览器内直接运行 Python 代码
- ✓ 自动批改 + 进度追踪
30天
¥18
1年
¥99
2年
¥158
3年
¥199