修改数据类型

This commit is contained in:
2025-10-28 13:08:56 +08:00
parent 1b030c9522
commit 7ea3f83374
+3 -3
View File
@@ -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)