From 7ceb4fa1822f520cb87b6e39cf496c5701dcf41a Mon Sep 17 00:00:00 2001 From: "shenjian@fangjia.com" Date: Mon, 5 Dec 2022 17:01:49 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E5=9F=8E=E5=B8=82=E5=9D=87?= =?UTF-8?q?=E4=BB=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dags/business/business/community/price.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/dags/business/business/community/price.py b/dags/business/business/community/price.py index f121329..59dc171 100644 --- a/dags/business/business/community/price.py +++ b/dags/business/business/community/price.py @@ -37,13 +37,20 @@ def build_doc(item): def sync(city=None): log.info(f"开始同步价格信息至206 {index_name}") - seaweed_query = {'cat': 'district', 'status': 0} if pd.notna(city): - seaweed_query['city'] = city cities = [city] else: cities = None seaweed_df = pd.read_csv(path + '/seaweed.csv', sep='@', encoding='UTF-8') + if pd.notna(city): + seaweed_df = seaweed_df[seaweed_df['city'] == city].copy() + seaweed_df = seaweed_df.reset_index(drop=True) + + # 小区所在城市均价 + city_price_df = commutils.get_city_price(city=city) + city_price_df = city_price_df[['city', 'avg_price']] + city_price_df = city_price_df.rename(columns={'avg_price': 'city_avg_price'}) + seaweed_df = pd.merge(seaweed_df, city_price_df, how='left', on=['city']) # 小区所在区域均价 region_price_df = commutils.get_region_price(city=city)