新增商铺价格计算

This commit is contained in:
沈健
2025-04-09 17:49:17 +08:00
parent 12f1dcf7cf
commit b61199d0be
5 changed files with 146 additions and 2 deletions
+2 -2
View File
@@ -20,7 +20,7 @@ def calc(city, year_month):
"select * from latest_seawater where cat='shop_rent' and city='" + city + "' and p_date>=" + str(
year_month) + "01 and p_date<=" + str(year_month) + "31 ")
if len(shop) > 0:
shop['day_avg_price'] = shop['day_rent_price']
shop['day_avg_price'] = shop['avg_price'] / 30
# 计算总价的Z-score
shop['Z_Score'] = (shop['day_avg_price'] - shop['day_avg_price'].mean()) / shop['day_avg_price'].std()
# 剔除Z-score超过0.1的异常值
@@ -94,7 +94,7 @@ except Exception as e:
# # 初始化从2024年9月
# 创建从2024年9月到2024年12月的日期范围
# date_range = pd.date_range(start='2024-09-01', end='2025-01-31', freq='M')
# date_range = pd.date_range(start='2024-09-01', end='2025-02-28', freq='M')
#
# # 创建一个包含这些日期的DataFrame
# df = pd.DataFrame({'date': date_range, 'value': range(1, len(date_range) + 1)})