From aafafccb288da1a8219f3469b98baabd6ba9b63e Mon Sep 17 00:00:00 2001 From: sjshenjian Date: Tue, 9 Jul 2024 16:28:43 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E7=9C=81=E5=B8=82=E5=8C=BA?= =?UTF-8?q?=E5=85=A8=E6=8B=BC=E8=BD=AC=E6=8D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dags/business/business/community/full_name.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/dags/business/business/community/full_name.py b/dags/business/business/community/full_name.py index 91a8778..867262d 100644 --- a/dags/business/business/community/full_name.py +++ b/dags/business/business/community/full_name.py @@ -16,10 +16,10 @@ m_date = dateutils.iso_format() count = 0 -short_df = es89_client.scan_by_sql_to_data_frame("select city, city_short, district, district_short from administrative_mapping where type='区域' ") +short_df = es89_client.scan_by_sql_to_data_frame("select province, city, city_short, district, district_short from administrative_mapping where type='区域' ") short_map = {} def deal_short_map(x): - short_map[x['city_short'] + x['district_short']] = x['city'] + '|' + x['district'] + short_map[x['city_short'] + x['district_short']] = x['province'] + '|' + x['city'] + '|' + x['district'] short_df.apply(lambda x: deal_short_map(x), axis=1) def deal(actions, x): @@ -28,8 +28,9 @@ def deal(actions, x): if pd.notna(x['city']) and pd.notna(x['region']): if x['city'] + x['region'] in short_map: short_info = short_map[x['city'] + x['region']] - doc_info['city'] = short_info.split('|')[0] - doc_info['region'] = short_info.split('|')[1] + doc_info['province_full'] = short_info.split('|')[0] + doc_info['city_full'] = short_info.split('|')[1] + doc_info['region_full'] = short_info.split('|')[2] action_doc = { "_op_type": "update",