From 2eecb42410762e190fcddffb9a6b0f73da96813e Mon Sep 17 00:00:00 2001 From: "shenjian@fangjia.com" Date: Wed, 29 Mar 2023 15:55:48 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E5=AD=97=E6=AE=B5=E7=BB=9F?= =?UTF-8?q?=E8=AE=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dags/stat/community/community_count_price_rent.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/dags/stat/community/community_count_price_rent.py b/dags/stat/community/community_count_price_rent.py index fa94b89..802aeb1 100644 --- a/dags/stat/community/community_count_price_rent.py +++ b/dags/stat/community/community_count_price_rent.py @@ -5,6 +5,9 @@ from goojia_utils import MAIN_MONGO_CLIENT, dateutils, ClickHouseClient, ElasticSearchClient import pandas as pd import os +import logging + +log = logging.getLogger(__name__) server_area_conn = MAIN_MONGO_CLIENT.get_collection('fangjia', 'server_area') seaweed_conn = MAIN_MONGO_CLIENT.get_collection('fangjia', 'seaweed') @@ -18,10 +21,12 @@ es206_client = ElasticSearchClient(host='192.168.0.206') city_df = pd.DataFrame(list(server_area_conn.find({}, {'city_grade': 1, 'display': 1}))) city_df = city_df.rename(columns={'city_grade': 'city_level', 'display': 'city'}) city_df = city_df[city_df['city_level'] != 0] +# 昆玉无小区 +city_df = city_df[city_df['city'] != '昆玉'].reset_index(drop=True) seaweed_df = pd.DataFrame( list(seaweed_conn.find({'cat': 'district', 'status': 0}, {'city': 1, 'region': 1, 'name': 1, 'alias': 1, 'addr_alias': 1}) - .batch_size(10000))) + .batch_size(100000))) path = "/opt/airflow/dags/repo/dags/business/business/community/data" @@ -39,6 +44,8 @@ for index, item in city_df.iterrows(): seaweed_count = 0 # 楼盘数量 city_df.loc[index, 'community_count'] = len(region_df) + if len(region_df) == 0: + log.error(f"该城市{city}小区数量为0") for index1, item1 in region_df.iterrows(): flag = True if type(item1['alias']) == list: