diff --git a/dags/business/business/community/consumption.py b/dags/business/business/community/consumption.py index f903d3d..d4f7afd 100644 --- a/dags/business/business/community/consumption.py +++ b/dags/business/business/community/consumption.py @@ -91,7 +91,7 @@ def calc_consumption_potential(city): max_avg_cost_fixed = community_summary_df['avg_cost_fixed'].max() max_estate_charge_fixed = community_summary_df['estate_charge_fixed'].max() max_relative_price_ranking = community_summary_df['relative_price_ranking'].max() - community_summary_df['total_price_fixed'] = 1 - np.log(community_summary_df['total_price_fixed'] + 1) / np.log(max_total_price_fixed + 1) + community_summary_df['total_price_fixed'] = np.log1p(community_summary_df['total_price_fixed']) # 人均消费极大值处理 community_summary_df['avg_cost_fixed'] = np.where(community_summary_df['avg_cost_fixed'] > 250, 250, community_summary_df['avg_cost_fixed']) @@ -101,8 +101,8 @@ def calc_consumption_potential(city): community_summary_df['avg_cost_fixed'] = None pass #community_summary_df['avg_cost_fixed'] = 1 - np.log(community_summary_df['avg_cost_fixed'] + 1) / np.log(max_avg_cost_fixed + 1) - community_summary_df['estate_charge_fixed'] = 1 - np.log(community_summary_df['estate_charge_fixed'] + 1) / np.log(max_estate_charge_fixed + 1) - community_summary_df['relative_price_ranking'] = 1 - np.log(community_summary_df['relative_price_ranking'] + 1) / np.log(max_relative_price_ranking + 1) + community_summary_df['estate_charge_fixed'] = np.log1p(community_summary_df['estate_charge_fixed']) + community_summary_df['relative_price_ranking'] = np.log1p(community_summary_df['relative_price_ranking']) community_summary_df['estate_charge_mean'] = community_summary_df.groupby(by=['city'])['estate_charge_fixed'].transform( np.mean)