修改数据类型
This commit is contained in:
@@ -42,7 +42,7 @@ def calc(city, year_month):
|
|||||||
dateutils.format_date(dateutils.add_months(dateutils.parse_date(str(year_month), '%Y%m'), months=-1), '%Y%m'))
|
dateutils.format_date(dateutils.add_months(dateutils.parse_date(str(year_month), '%Y%m'), months=-1), '%Y%m'))
|
||||||
if pd.isna(city_price):
|
if pd.isna(city_price):
|
||||||
# 处理均价为空情况,用上月均价替代
|
# 处理均价为空情况,用上月均价替代
|
||||||
stat = office_rent_stat_conn.find_one({'city': city, 'cat': 'city', 'date': last_month})
|
stat = office_rent_stat_conn.find_one({'city': city, 'cat': 'city', 'date': int(last_month)})
|
||||||
if pd.isna(stat):
|
if pd.isna(stat):
|
||||||
return False
|
return False
|
||||||
last_month_city_price = stat['avg_price']
|
last_month_city_price = stat['avg_price']
|
||||||
@@ -51,8 +51,8 @@ def calc(city, year_month):
|
|||||||
city_price = last_month_city_price
|
city_price = last_month_city_price
|
||||||
|
|
||||||
# 写入MONGODB
|
# 写入MONGODB
|
||||||
action = UpdateOne({'city': city, 'cat': 'city', 'date': year_month},
|
action = UpdateOne({'city': city, 'cat': 'city', 'date': int(year_month)},
|
||||||
{'$set': {'city': city, 'cat': 'city', 'date': year_month, 'avg_price': city_price,
|
{'$set': {'city': city, 'cat': 'city', 'date': int(year_month), 'avg_price': city_price,
|
||||||
'updated_date': datetime.now()}},
|
'updated_date': datetime.now()}},
|
||||||
upsert=True)
|
upsert=True)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user