修改数据类型
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user