优化
This commit is contained in:
@@ -13,8 +13,6 @@ last = dateutils.add_months(first_day, 0, -2, 0, 0)
|
||||
last_day = last.strftime('%Y%m%d')
|
||||
|
||||
log.info(f"系统当前时间 : {now}")
|
||||
token = '1b6d0d782d3c316f2d3b6b18ea5144816170dd392befbf2042a24a01fb84b736'
|
||||
dingutils.send_text('【房源样本数量自动检测】数据已生成完毕,请点击 https://nextcloud.fangjia.com/s/KwxGsosMcnYxdoa 查看详情', token)
|
||||
|
||||
def proc():
|
||||
# 区域维度,统计2个月内样本数据量
|
||||
@@ -101,10 +99,6 @@ def proc():
|
||||
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():
|
||||
"""
|
||||
上传统计信息至nextcloud
|
||||
@@ -117,17 +111,18 @@ def up_to_nextcloud():
|
||||
nxc = NextCloud(endpoint=NEXTCLOUD_URL, user=NEXTCLOUD_USERNAME, password=NEXTCLOUD_PASSWORD)
|
||||
nxc.upload_file(air_file_name, nextcloud_file_name)
|
||||
|
||||
|
||||
if text != '':
|
||||
with pd.ExcelWriter(air_file_name) as writer:
|
||||
if not df_region_res.empty:
|
||||
df_region_res.to_excel(writer, sheet_name="房源样本数量检测-区域维度", columns=["city", "region", 'count'], index=False)
|
||||
if not df_root_city_res.empty:
|
||||
df_root_city_res.to_excel(writer, sheet_name="房源样本数量检测-房源网站维度(样本数)", columns=['root', 'city', 'count'],
|
||||
index=False)
|
||||
if not df_root_res.empty:
|
||||
df_root_res.to_excel(writer, sheet_name="房源样本数量检测-房源网站维度(样本减少百分比)", columns=['root', count_old, count_new],
|
||||
index=False)
|
||||
up_to_nextcloud()
|
||||
token = '1b6d0d782d3c316f2d3b6b18ea5144816170dd392befbf2042a24a01fb84b736'
|
||||
dingutils.send_text(text, token)
|
||||
if __name__ == '__main__':
|
||||
text, air_file_name, df_region_res, df_root_city_res, df_root_res, file_name, count_old, count_new = proc()
|
||||
if text != '':
|
||||
with pd.ExcelWriter(air_file_name) as writer:
|
||||
if not df_region_res.empty:
|
||||
df_region_res.to_excel(writer, sheet_name="房源样本数量检测-区域维度", columns=["city", "region", 'count'], index=False)
|
||||
if not df_root_city_res.empty:
|
||||
df_root_city_res.to_excel(writer, sheet_name="房源样本数量检测-房源网站维度(样本数)", columns=['root', 'city', 'count'],
|
||||
index=False)
|
||||
if not df_root_res.empty:
|
||||
df_root_res.to_excel(writer, sheet_name="房源样本数量检测-房源网站维度(样本减少百分比)", columns=['root', count_old, count_new],
|
||||
index=False)
|
||||
up_to_nextcloud()
|
||||
token = '1b6d0d782d3c316f2d3b6b18ea5144816170dd392befbf2042a24a01fb84b736'
|
||||
dingutils.send_text(text, token)
|
||||
|
||||
Reference in New Issue
Block a user