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