新增均价计算类型

This commit is contained in:
沈健
2025-04-08 14:13:21 +08:00
parent c640d914cc
commit 56519e159c
2 changed files with 7 additions and 4 deletions
@@ -56,7 +56,7 @@ def detail(city):
"relative_price_ranking",
"avg_cost",
"consumption_rating",
"price_rating",
"price_rating", "avg_price_calc_type",
"consumption_score",
"sub_factor.total_price_rating"
], index="community_summary")
@@ -73,7 +73,8 @@ def detail(city):
'avg_cost': '人均消费', 'estate_charge': '物业费', 'estate_charge_fix': '物业费修正', 'price_rating': '价格评级', 'estate_charge_type': '物业费获取方式',
'credit': '置信度'
})
community_summary_df['计算方式'] = None
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,'周边','自有')
aim_file = dateutils.format_date(dateutils.localize()) + '财力评级结果.csv'
community_summary_df.to_csv(save_png_path + '/' + aim_file, index=False, columns=["城市", "区域", "小区名称", "财力分数", "财力评级", "户均总价评级", "差值", "户均总价", "小区均价", "计算方式", "典型面积",
+4 -2
View File
@@ -36,6 +36,8 @@ def build_doc(item):
doc_dict['rent_price'] = int(item['rent_price'])
if 'guide_price' in item and pd.notna(item['guide_price']):
doc_dict['guide_price'] = int(item['guide_price'])
if 'avg_price_calc_type' in item and pd.notna(item['avg_price_calc_type']):
doc_dict['avg_price_calc_type'] = int(item['avg_price_calc_type'])
return doc_dict
@@ -61,8 +63,8 @@ def sync_by_city(city):
# 小区均价
avg_price_df = commutils.get_avg_price(city=city)
if len(avg_price_df) > 0:
avg_price_df = avg_price_df[['city', 'district_name', 'region', 'avg_price']]
avg_price_df = avg_price_df.rename(columns={'district_name': 'name'})
avg_price_df = avg_price_df[['city', 'district_name', 'region', 'avg_price', 'value_type']]
avg_price_df = avg_price_df.rename(columns={'district_name': 'name', 'value_type': 'avg_price_calc_type'})
seaweed_df = pd.merge(seaweed_df, avg_price_df, how='left', on=['city', 'region', 'name'])
# 小区均价区域排名