新增69个城市阈值
This commit is contained in:
@@ -27,7 +27,11 @@ for city in cities:
|
||||
action['curr_city'] = city
|
||||
action['count'] = len(temp_df)
|
||||
for item in result_df.columns:
|
||||
action[item] = round(len(temp_df[temp_df[item].notna()]) * 100 / len(temp_df), 2)
|
||||
if item == 'deal_num' or item == 'school' or item == 'market' or item == 'subway' \
|
||||
or item == 'bank' or item == 'hospital':
|
||||
action[item] = round(len(temp_df[temp_df[item] > 0]) * 100 / len(temp_df), 2)
|
||||
else:
|
||||
action[item] = round(len(temp_df[temp_df[item].notna()]) * 100 / len(temp_df), 2)
|
||||
if action['rent_price'] < 90:
|
||||
action['rent_flag'] = '租金覆盖率低于90%'
|
||||
if action['avg_price'] < 90:
|
||||
@@ -41,7 +45,7 @@ df.to_excel(aim_file_name, index=False)
|
||||
|
||||
def deal_nan_val(x):
|
||||
if np.isnan(x['avg_price']):
|
||||
x['avg_price'] = None
|
||||
x['avg_price'] = None
|
||||
if np.isnan(x['rent_price']):
|
||||
x['rent_price'] = None
|
||||
if np.isnan(x['lng']):
|
||||
@@ -122,7 +126,8 @@ def save2_clickhouse():
|
||||
# 删除旧数据
|
||||
clickhouse_client.execute(
|
||||
"ALTER TABLE fangjia_stat.mt_community_stat DELETE WHERE city='" + city + "' and year_month = toDate('" + curr_month_start + "')")
|
||||
clickhouse_client.to_sql(data=temp_df, table='mt_community_stat', engine='MergeTree', if_exists=False, order_by={'year_month'})
|
||||
clickhouse_client.to_sql(data=temp_df, table='mt_community_stat', engine='MergeTree', if_exists=False,
|
||||
order_by={'year_month'})
|
||||
|
||||
|
||||
def up_to_nextcloud():
|
||||
|
||||
Reference in New Issue
Block a user