新增格子
This commit is contained in:
@@ -48,6 +48,32 @@ params_rect = tbd.area_to_params(china_bounds, accuracy=accuracy)
|
||||
|
||||
estate_type_list = ["普通住宅", "别墅", "商住"]
|
||||
|
||||
|
||||
def save_to_community_summary(comm_df):
|
||||
actions = list()
|
||||
count = 0
|
||||
for index, item in comm_df.iterrows():
|
||||
doc_info = {'grid_id': item['grid_id']}
|
||||
|
||||
action = {
|
||||
"_op_type": "update",
|
||||
"_index": "community_summary",
|
||||
"_id": item['_id'],
|
||||
"doc": doc_info,
|
||||
"_retry_on_conflict": 5
|
||||
}
|
||||
|
||||
actions.append(action)
|
||||
if len(actions) == 5000:
|
||||
helpers.bulk(es206_client.elastic_client, actions)
|
||||
count += len(actions)
|
||||
log.info("更新:" + str(count))
|
||||
actions.clear()
|
||||
if len(actions) > 0:
|
||||
helpers.bulk(es206_client.elastic_client, actions)
|
||||
actions.clear()
|
||||
|
||||
|
||||
def sync(city):
|
||||
sql = f"select * from grid "
|
||||
if pd.notna(city):
|
||||
@@ -73,6 +99,8 @@ def sync(city):
|
||||
x['grid_id'] = str(lon_lat_col[0]) + "_" + str(lon_lat_col[1])
|
||||
return x
|
||||
comm_df = comm_df.apply(lambda x: deal_lng_lat(x), axis=1)
|
||||
# 格子信息写入community_summary
|
||||
save_to_community_summary(comm_df)
|
||||
# 求解格子均价
|
||||
actions = list()
|
||||
count = 0
|
||||
|
||||
Reference in New Issue
Block a user