From d8543eae5bc853c7c3894adfc9857b6ae699f35c Mon Sep 17 00:00:00 2001 From: Jian Shen Date: Sat, 18 Mar 2023 14:14:27 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E5=86=99=E5=85=A5=E4=B8=AD?= =?UTF-8?q?=E9=97=B4=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dags/business/business/community/comm.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/dags/business/business/community/comm.py b/dags/business/business/community/comm.py index 6221565..818b708 100644 --- a/dags/business/business/community/comm.py +++ b/dags/business/business/community/comm.py @@ -103,6 +103,14 @@ def sync(city=None): sql += f" where city='{city}'" community_summary_df = es206_client.scan_by_sql_to_data_frame(sql) seaweed_df['_id'] = seaweed_df['_id'].astype(str) + # 清除别名中逗号 + def dealAlias(x): + if isinstance(x, list) and len(x) > 0: + for index, element in enumerate(x): + if "'" in element: + x[index] = str(element).replace("'", "") + return x + seaweed_df['alias'] = seaweed_df['alias'].apply(lambda x: dealAlias(x)) if len(community_summary_df) > 0: community_summary_df['flag'] = 1 @@ -114,7 +122,7 @@ def sync(city=None): seaweed_not_existed_df = seaweed_df # 写入csv文件,防止小区变动导致的后续过程更新报错, - #seaweed_df.to_csv(path + '/seaweed.csv', sep='@', encoding='UTF-8', index=False) + seaweed_df.to_csv(path + '/seaweed.csv', sep='@', encoding='UTF-8', index=False) # 写入中间表clickhouse,解决多worker节点问题 tmp_ck.to_sql_plus(seaweed_df, 'community_summary')