优化
This commit is contained in:
@@ -65,6 +65,9 @@ def save(actions, item):
|
||||
estate_type = item['estate_type']
|
||||
location = item['location']
|
||||
|
||||
if pd.isna(location) or pd.isna(location['lon']):
|
||||
return
|
||||
|
||||
if pd.notna(item['tag']):
|
||||
extra_info.append(item['tag'])
|
||||
|
||||
@@ -76,6 +79,7 @@ def save(actions, item):
|
||||
if item['kindergarten_num'] > 0 or item['key_primary_school_num'] > 0 or item['ordinary_primary_school_num'] > 0 or item['key_middle_school_num'] > 0 or item['ordinary_middle_school_num'] > 0:
|
||||
extra_info.append("靠近学校")
|
||||
|
||||
|
||||
good_count = find_by_location(city, 500, [location['lon'], location['lat']], '生活配套', ['其他', '商场'])
|
||||
if good_count['count'] > 0:
|
||||
extra_info.append("繁华")
|
||||
@@ -120,17 +124,17 @@ def sync(city=None):
|
||||
|
||||
community_summary_df = pd.merge(community_summary_df, district_analy_data_df, how='left', on=['city', 'region', 'name'])
|
||||
|
||||
# with ThreadPoolExecutor(max_workers=30) as pool:
|
||||
# actions = list()
|
||||
#
|
||||
# for index, item in community_summary_df.iterrows():
|
||||
# pool.submit(save, actions, item)
|
||||
# if len(actions) > 0:
|
||||
# helpers.bulk(es206_client.elastic_client, actions)
|
||||
# actions.clear()
|
||||
actions = list()
|
||||
for index, item in community_summary_df.iterrows():
|
||||
save(actions, item)
|
||||
with ThreadPoolExecutor(max_workers=30) as pool:
|
||||
actions = list()
|
||||
|
||||
for index, item in community_summary_df.iterrows():
|
||||
pool.submit(save, actions, item)
|
||||
if len(actions) > 0:
|
||||
helpers.bulk(es206_client.elastic_client, actions)
|
||||
actions.clear()
|
||||
# actions = list()
|
||||
# for index, item in community_summary_df.iterrows():
|
||||
# save(actions, item)
|
||||
|
||||
log.info(f"完成同步附加标签至206 {index_name}")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user