新增省市区全拼转换
This commit is contained in:
@@ -16,10 +16,10 @@ m_date = dateutils.iso_format()
|
|||||||
|
|
||||||
count = 0
|
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 = {}
|
short_map = {}
|
||||||
def deal_short_map(x):
|
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)
|
short_df.apply(lambda x: deal_short_map(x), axis=1)
|
||||||
|
|
||||||
def deal(actions, x):
|
def deal(actions, x):
|
||||||
@@ -28,8 +28,9 @@ def deal(actions, x):
|
|||||||
if pd.notna(x['city']) and pd.notna(x['region']):
|
if pd.notna(x['city']) and pd.notna(x['region']):
|
||||||
if x['city'] + x['region'] in short_map:
|
if x['city'] + x['region'] in short_map:
|
||||||
short_info = short_map[x['city'] + x['region']]
|
short_info = short_map[x['city'] + x['region']]
|
||||||
doc_info['city'] = short_info.split('|')[0]
|
doc_info['province_full'] = short_info.split('|')[0]
|
||||||
doc_info['region'] = short_info.split('|')[1]
|
doc_info['city_full'] = short_info.split('|')[1]
|
||||||
|
doc_info['region_full'] = short_info.split('|')[2]
|
||||||
|
|
||||||
action_doc = {
|
action_doc = {
|
||||||
"_op_type": "update",
|
"_op_type": "update",
|
||||||
|
|||||||
Reference in New Issue
Block a user