From ab5f78cc7b6a0436eabd4b1205b2c2a0db555b1a Mon Sep 17 00:00:00 2001 From: liuyebo <1515783401@qq.com> Date: Wed, 30 Jul 2025 15:11:01 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B5=8B=E8=AF=95=E5=9B=BE=E7=89=87=E6=B8=85?= =?UTF-8?q?=E6=99=B0=E5=BA=A6=E6=A8=A1=E5=9E=8B=E6=95=88=E6=9E=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tool/check_clarity_model.py | 43 +++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 tool/check_clarity_model.py diff --git a/tool/check_clarity_model.py b/tool/check_clarity_model.py new file mode 100644 index 0000000..6ec2b95 --- /dev/null +++ b/tool/check_clarity_model.py @@ -0,0 +1,43 @@ +import pandas as pd + +from db import MysqlSession +from db.mysql import ZxPhrec + + +def check_unclarity(): + file_path = r'D:\Echo\Downloads\unclare.xlsx' # 将 your_file.xlsx 替换为你的文件路径 + df = pd.read_excel(file_path) + + # 循环读取 pk_phrec 列 + output_file_path = 'check_unclarity_result.txt' + with open(output_file_path, 'w') as f: + for pk_phrec in df['pk_phrec']: + session = MysqlSession() + phrec = session.query(ZxPhrec.pk_phrec, ZxPhrec.cfjaddress2, ZxPhrec.unsharp_flag).filter( + ZxPhrec.pk_phrec == pk_phrec + ).one_or_none() + session.close() + if phrec and phrec.unsharp_flag == 0: + f.write(f"{phrec.pk_phrec} {phrec.cfjaddress2}\n") + + +def check_clarity(): + file_path = r'D:\Echo\Downloads\unclare.xlsx' + df = pd.read_excel(file_path) + session = MysqlSession() + phrecs = (session.query(ZxPhrec.pk_phrec, ZxPhrec.cfjaddress2, ZxPhrec.unsharp_flag) + .filter(ZxPhrec.pk_phrec >= 30810206) + .filter(ZxPhrec.pk_phrec <= 31782247) + .filter(ZxPhrec.unsharp_flag == 1) + .all()) + session.close() + + output_file_path = 'check_clarity_result.txt' + with open(output_file_path, 'w') as f: + for phrec in phrecs: + if phrec.pk_phrec not in df['pk_phrec'].to_list(): + f.write(f"{phrec.pk_phrec} {phrec.cfjaddress2}\n") + + +if __name__ == '__main__': + check_clarity()