From 7ea3f83374c4b690c15ff71df51df9b3fc762bb8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E6=96=87=E8=89=B3?= Date: Tue, 28 Oct 2025 13:08:56 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=95=B0=E6=8D=AE=E7=B1=BB?= =?UTF-8?q?=E5=9E=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dags/office/rent/price.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/dags/office/rent/price.py b/dags/office/rent/price.py index 8e8611d..935f0c3 100644 --- a/dags/office/rent/price.py +++ b/dags/office/rent/price.py @@ -64,7 +64,7 @@ def calc(city, year_month): avg_price = region_avg_prices[region] else: # 处理均价为空情况,用上月均价替代 - district_stat = office_rent_stat_conn.find_one({'city': city, 'cat': 'district', 'date': last_month, 'district': region}) + district_stat = office_rent_stat_conn.find_one({'city': city, 'cat': 'district', 'date': int(last_month), 'district': region}) if pd.isna(district_stat): continue last_month_region_price = district_stat['avg_price'] @@ -72,8 +72,8 @@ def calc(city, year_month): continue avg_price = last_month_region_price - action = UpdateOne({'city': city, 'cat': 'district', 'date': year_month, 'district': region}, - {'$set': {'city': city, 'cat': 'district', 'date': year_month, 'district': region, + action = UpdateOne({'city': city, 'cat': 'district', 'date': int(year_month), 'district': region}, + {'$set': {'city': city, 'cat': 'district', 'date': int(year_month), 'district': region, 'avg_price': round(avg_price, 2), 'updated_date': datetime.now()}}, upsert=True) actions.append(action)