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')