添加楼盘评级算法

This commit is contained in:
2024-08-14 09:20:04 +08:00
parent 5d94eb7bd0
commit cc2a198a83
+8 -3
View File
@@ -14,6 +14,8 @@ last_day = last.strftime('%Y%m%d')
log.info(f"系统当前时间 : {now}") log.info(f"系统当前时间 : {now}")
def proc():
# 区域维度,统计2个月内样本数据量 # 区域维度,统计2个月内样本数据量
es206_client = ElasticSearchClient(host='192.168.0.206') es206_client = ElasticSearchClient(host='192.168.0.206')
sql = 'select city,region,p_date,cat,root from seawater where cat = \'sell\' and p_date >=' + str( sql = 'select city,region,p_date,cat,root from seawater where cat = \'sell\' and p_date >=' + str(
@@ -94,8 +96,11 @@ if df_root_city_res.empty == False:
path = "/home/airflow/data/jh/price" path = "/home/airflow/data/jh/price"
file_name = f"{now_day}房源样本数量检测.xlsx" file_name = f"{now_day}房源样本数量检测.xlsx"
air_file_name = path + '/' + file_name air_file_name = path + '/' + file_name
return text, air_file_name, df_region_res, df_root_city_res, df_root_res,file_name,count_old,count_new
text, air_file_name, df_region_res, df_root_city_res, df_root_res, file_name, count_old, count_new = proc()
def up_to_nextcloud(): def up_to_nextcloud():
""" """
上传统计信息至nextcloud 上传统计信息至nextcloud
@@ -111,12 +116,12 @@ def up_to_nextcloud():
if text != '': if text != '':
with pd.ExcelWriter(air_file_name) as writer: with pd.ExcelWriter(air_file_name) as writer:
if df_region_res.empty == False: if not df_region_res.empty:
df_region_res.to_excel(writer, sheet_name="房源样本数量检测-区域维度", columns=["city", "region", 'count'], index=False) df_region_res.to_excel(writer, sheet_name="房源样本数量检测-区域维度", columns=["city", "region", 'count'], index=False)
if df_root_city_res.empty == False: if not df_root_city_res.empty:
df_root_city_res.to_excel(writer, sheet_name="房源样本数量检测-房源网站维度(样本数)", columns=['root', 'city', 'count'], df_root_city_res.to_excel(writer, sheet_name="房源样本数量检测-房源网站维度(样本数)", columns=['root', 'city', 'count'],
index=False) index=False)
if df_root_res.empty == False: if not df_root_res.empty:
df_root_res.to_excel(writer, sheet_name="房源样本数量检测-房源网站维度(样本减少百分比)", columns=['root', count_old, count_new], df_root_res.to_excel(writer, sheet_name="房源样本数量检测-房源网站维度(样本减少百分比)", columns=['root', count_old, count_new],
index=False) index=False)
up_to_nextcloud() up_to_nextcloud()