From 3a7c6b683c4771913508c9c2ac3ae53320eff723 Mon Sep 17 00:00:00 2001 From: wangwenyan Date: Mon, 16 Jun 2025 18:11:52 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E6=A5=BC=E7=9B=98=E8=AF=84?= =?UTF-8?q?=E7=BA=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dags/stat/community/community_rate.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/dags/stat/community/community_rate.py b/dags/stat/community/community_rate.py index 6b87627..58c1e71 100644 --- a/dags/stat/community/community_rate.py +++ b/dags/stat/community/community_rate.py @@ -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}") \ No newline at end of file