优化楼盘评级
This commit is contained in:
@@ -455,6 +455,8 @@ if __name__ == '__main__':
|
||||
data["comm_id"] = data['_id']
|
||||
db_df = data[db_fields]
|
||||
df_simple = db_df.copy()
|
||||
if "business_quarter" not in df_simple.columns:
|
||||
df_simple['business_quarter'] = None
|
||||
for factor_score_field in ['total_score', 'community_quality_score', 'community_price_score',
|
||||
'location_advantage_score', 'flowability_score', 'living_facilities_score',
|
||||
'education_score', 'hospital_score']:
|
||||
@@ -486,7 +488,7 @@ if __name__ == '__main__':
|
||||
df_simple[f'{score_factor}'] = df_simple[f'{score_factor}'].apply(lambda x: round(x * 100, 2))
|
||||
|
||||
updater = MongoDataFrameUpdater(community_rate_client)
|
||||
updater.bulk_insert_or_update_by_id(db_df, id_fields=['comm_id'])
|
||||
updater.bulk_insert_or_update_by_id(df_simple, id_fields=['comm_id'])
|
||||
logger.info(f"楼盘评级计算结束:{city}")
|
||||
except Exception as e:
|
||||
logging.error(f"{city}楼盘评级计算失败;{e}")
|
||||
Reference in New Issue
Block a user