优化同步过程中小区变更问题
This commit is contained in:
@@ -3,11 +3,10 @@
|
||||
"""
|
||||
import logging
|
||||
import pandas as pd
|
||||
from goojia_utils import MAIN_MONGO_CLIENT, ElasticSearchClient, commutils, dateutils, areautils
|
||||
from goojia_utils import ElasticSearchClient, commutils, dateutils
|
||||
from elasticsearch import helpers
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
seaweed_conn = MAIN_MONGO_CLIENT.get_collection('fangjia', 'seaweed')
|
||||
es206_client = ElasticSearchClient(host='192.168.0.206')
|
||||
|
||||
index_name = "community_summary"
|
||||
@@ -43,9 +42,7 @@ def sync(city=None):
|
||||
cities = [city]
|
||||
else:
|
||||
cities = None
|
||||
seaweed_df = pd.DataFrame(
|
||||
list(seaweed_conn.find(seaweed_query, {'city': 1, 'region': 1, 'name': 1})
|
||||
.batch_size(100000)))
|
||||
seaweed_df = pd.read_csv('/opt/airflow/dags/repo/dags/business/community/data/seaweed.csv', sep='@', encoding='UTF-8')
|
||||
|
||||
# 小区所在区域均价
|
||||
region_price_df = commutils.get_region_price(city=city)
|
||||
@@ -89,8 +86,6 @@ def sync(city=None):
|
||||
gov_price_df = gov_price_df.rename(columns={'avg_price': 'guide_price'})
|
||||
seaweed_df = pd.merge(seaweed_df, gov_price_df, how='left', on=['city', 'region', 'name'])
|
||||
|
||||
seaweed_df['_id'] = seaweed_df['_id'].astype(str)
|
||||
|
||||
actions = list()
|
||||
count = 0
|
||||
for index, item in seaweed_df.iterrows():
|
||||
|
||||
Reference in New Issue
Block a user