fix(office): filter abnormal rent sample prices and fix city variable shadowing in base_price

This commit is contained in:
王文艳
2026-10-19 10:46:15 +08:00
parent fb8f6400be
commit 0d65af4be7
3 changed files with 18 additions and 10 deletions
+3 -2
View File
@@ -217,6 +217,7 @@ def calcByCity(city, year_month):
def update_office(city, office, sample, year_month):
target_city = city
if 'bed_kind' not in office.columns:
office['bed_kind'] = None
if 'estate_type2' not in office.columns:
@@ -446,8 +447,8 @@ def update_office(city, office, sample, year_month):
actions.clear()
# 第五步
query = {'cat': 'office', 'date': year_month, 'calc_type': {'$in': [1, 2, 3]}}
if pd.notna(city):
query['city'] = city
if pd.notna(target_city) and target_city != '':
query['city'] = target_city
db_df = pd.DataFrame(list(office_sell_stat_conn.find(query)))
office_info = office[['city', 'region', 'name', 'lng', 'lat', 'estate_type2', 'bed_kind']].drop_duplicates(
keep='first')