新增子因子评分

This commit is contained in:
沈健
2025-04-14 11:23:32 +08:00
parent 027ba5ef1f
commit 3c77ac061c
@@ -122,7 +122,6 @@ def detail(city):
"name",
"avg_price",
"total_price",
"credit_detail.total_price_score",
"estate_charge",
"estate_charge_fix",
"estate_charge_flag",
@@ -132,11 +131,17 @@ def detail(city):
"consumption_rating",
"price_rating", "avg_price_calc_type",
"consumption_score",
"sub_factor.total_price_rating"
"sub_factor.total_price_rating",
"sub_factor.total_price_score",
"sub_factor.estate_charge_score",
"sub_factor.relative_price_score",
"sub_factor.avg_cost_score",
"credit_detail.total_price_score"
], index="community_summary")
# 减少重复查询
community_summary_df = data_utils.flatten_json(community_summary_df, 'sub_factor')
community_summary_df = data_utils.flatten_json(community_summary_df, 'credit_detail')
community_summary_df = community_summary_df.rename(columns={'total_price_score': 'credit_detail_total_price_score'})
community_summary_df = data_utils.flatten_json(community_summary_df, 'sub_factor')
community_summary_df['diff'] = np.abs(community_summary_df['consumption_rating'] - community_summary_df['price_rating'])
community_summary_df['total_price_diff'] = np.abs(community_summary_df['consumption_rating'] - community_summary_df['total_price_rating'])
community_summary_df['estate_charge_type'] = np.where(
@@ -151,21 +156,21 @@ def detail(city):
community_summary_df['credit'] = np.where(community_summary_df['total_price_diff'] == 0, '高', np.where(community_summary_df['total_price_diff'] == 1, '中', np.where(community_summary_df['total_price_diff'] >= 2, '低', '-')))
stat(community_summary_df)
community_summary_df = community_summary_df.rename(columns={'city': '城市', 'region': '区域', 'name': '小区名称', 'consumption_score': '财力分数', 'consumption_rating': '财力评级',
community_summary_df = community_summary_df.rename(columns={'city': '城市', 'region': '区域', 'name': '小区名称', 'consumption_score': '财力评分', 'consumption_rating': '财力评级',
'total_price_rating': '户均总价评级', 'total_price_diff': '差值',
'total_price': '户均总价', 'avg_price': '小区均价', 'main_house_area': '典型面积', 'relative_price_ranking': '相对价格排名',
'avg_cost': '人均消费', 'estate_charge': '物业费', 'estate_charge_fix': '物业费修正', 'price_rating': '价格评级', 'estate_charge_type': '物业费获取方式',
'credit': '置信度'
'credit': '置信度', 'total_price_score': '户均总价评分', 'estate_charge_score': '物业费评分', 'relative_price_score': '相对价格评分', 'avg_cost_score': '人均消费评分'
})
community_summary_df['计算方式'] = np.where(community_summary_df['avg_price_calc_type'] == 1,'指导价',np.where(community_summary_df['avg_price_calc_type'] == 2,'自身样本',np.where(community_summary_df['avg_price_calc_type'] == 3,'第三方',
np.where(community_summary_df['avg_price_calc_type'] == 4,'交易数据',np.where(community_summary_df['avg_price_calc_type'] == 5,'周边楼盘',np.where(community_summary_df['avg_price_calc_type'] == 6,'推导', np.where(community_summary_df['avg_price_calc_type'] == 7,'周边推算','无方式')))))))
community_summary_df['获取方式'] = np.where(community_summary_df['total_price_score'] <= 6,'周边','自有')
community_summary_df['获取方式'] = np.where(community_summary_df['credit_detail_total_price_score'] <= 6,'周边','自有')
aim_file = dateutils.format_date(dateutils.localize()) + '财力评级结果.csv'
community_summary_df.to_csv(save_png_path + '/' + aim_file, index=False, columns=["城市", "区域", "小区名称", "财力分数", "财力评级", "户均总价评级", "差值", "户均总价", "小区均价", "计算方式", "典型面积",
"获取方式", "相对价格排名", "人均消费", "物业费", "物业费获取方式", '置信度'])
community_summary_df.to_csv(save_png_path + '/' + aim_file, index=False, columns=["城市", "区域", "小区名称", "财力评分", "财力评级", "户均总价评级", "差值", "户均总价", "小区均价", "计算方式", "典型面积",
"获取方式", "相对价格排名", "人均消费", "物业费", "物业费获取方式", '置信度', '户均总价评分', '物业费评分', '相对价格评分', '人均消费评分'])
nextcloudutils.up_to_nextcloud(save_png_path + "/" + aim_file, nextcloud_aim_file_path + "/" + aim_file)
#dingutils.send_text("【统计】财力评级统计完毕,请点击 https://nextcloud.fangjia.com/s/nMbzk6ZKJDimapf 查看", "32400b949005817550937f82a82c064fe5be65c23204306442c15e8b485d7ef2")
dingutils.send_text("【统计】财力评级统计完毕,请点击 https://nextcloud.fangjia.com/s/nMbzk6ZKJDimapf 查看", "32400b949005817550937f82a82c064fe5be65c23204306442c15e8b485d7ef2")
sys_city = sys.argv[1] if len(sys.argv) > 1 else None