From b7ab8b9192b7098d99804558132ee218fc48c92f Mon Sep 17 00:00:00 2001 From: "shenjian@fangjia.com" Date: Wed, 29 Mar 2023 17:01:13 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E7=BD=AE=E4=BF=A1=E5=BA=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dags/stat/community/community_count_price_rent.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/dags/stat/community/community_count_price_rent.py b/dags/stat/community/community_count_price_rent.py index aded1dd..2568756 100644 --- a/dags/stat/community/community_count_price_rent.py +++ b/dags/stat/community/community_count_price_rent.py @@ -25,7 +25,8 @@ 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}) + list(seaweed_conn.find({'cat': 'district', 'status': 0}, + {'city': 1, 'region': 1, 'name': 1, 'alias': 1, 'addr_alias': 1}) .batch_size(100000))) path = "/opt/airflow/dags/repo/dags/business/business/community/data" @@ -187,8 +188,8 @@ df = pd.merge(df, deal_price_half_year_df, how='left', on=['city']) avg_price_df = commutils.get_avg_price() rent_price_df = commutils.get_rent_price() -avg_price_df['avg_price_count'] = avg_price_df.groupby(by=['city']).transform('count') -rent_price_df['sqmetre_rent_count'] = rent_price_df.groupby(by=['city']).transform('count') +avg_price_df['avg_price_count'] = avg_price_df.groupby(by=['city'])['_id'].transform('count') +rent_price_df['sqmetre_rent_count'] = rent_price_df.groupby(by=['city'])['_id'].transform('count') avg_price_df = avg_price_df[['city', 'avg_price_count']].drop_duplicates(keep='first') rent_price_df = rent_price_df[['city', 'sqmetre_rent_count']].drop_duplicates(keep='first')