新增物业费评级分布图
This commit is contained in:
@@ -6,7 +6,6 @@ import pandas as pd
|
||||
import numpy as np
|
||||
import logging
|
||||
import os
|
||||
import requests
|
||||
from elasticsearch import helpers
|
||||
|
||||
from sklearn.mixture import GaussianMixture
|
||||
@@ -167,4 +166,4 @@ def save_png(city=None):
|
||||
sync()
|
||||
save_png()
|
||||
nextcloudutils.up_to_nextcloud(save_png_path, nextcloud_aim_file_path)
|
||||
dingutils.send_text("【分布图生成完毕】财力评级已完成, 请点击 https://nextcloud.fangjia.com/s/CQdTiH9zW4tFs7T 查看分布图", "c7ac6c86bfbe49a95e30a68616c4d784ae7781c715430dc9c5f6b46d3e6ebd78")
|
||||
dingutils.send_text("【分布图生成完毕】财力评级已完成, 请点击 https://nextcloud.fangjia.com/s/gNTqRqnEnsYkJc4 查看分布图", "c7ac6c86bfbe49a95e30a68616c4d784ae7781c715430dc9c5f6b46d3e6ebd78")
|
||||
|
||||
@@ -1,12 +1,14 @@
|
||||
"""
|
||||
物业费等级计算
|
||||
"""
|
||||
from goojia_utils import ElasticSearchClient
|
||||
from goojia_utils import ElasticSearchClient, nextcloudutils, dingutils
|
||||
import pandas as pd
|
||||
import logging
|
||||
import os
|
||||
from elasticsearch import helpers
|
||||
|
||||
from sklearn.mixture import GaussianMixture
|
||||
from matplotlib import pyplot
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
@@ -14,6 +16,13 @@ es206_client = ElasticSearchClient(host='192.168.0.206')
|
||||
index_name = "community_summary"
|
||||
path = "/opt/airflow/dags/repo/dags/business/business/community/data"
|
||||
|
||||
nextcloud_aim_file_path = '共享/财力评级/物业费等级分布图'
|
||||
|
||||
save_path_prefix = "/home/airflow/data/community"
|
||||
save_png_path = save_path_prefix + "/estate_charge_ranking"
|
||||
if not os.path.exists(save_png_path):
|
||||
os.makedirs(save_png_path)
|
||||
|
||||
factor_df = pd.read_excel(path + '/财力评级极值设置.xlsx')
|
||||
factor_dict = dict()
|
||||
for index, item in factor_df.iterrows():
|
||||
@@ -87,4 +96,21 @@ def sync(city=None):
|
||||
calc_estate_charge_rating(community_summary_df)
|
||||
|
||||
|
||||
sync()
|
||||
def save_png(city=None):
|
||||
"""
|
||||
生成财力评级图表
|
||||
"""
|
||||
sql = "select id, city, region, name, consumption_rating from community_summary"
|
||||
if pd.notna(city):
|
||||
sql += " where city='" + city + "'"
|
||||
community_summary_df = es206_client.scan_by_sql_to_data_frame(sql)
|
||||
|
||||
for city in community_summary_df['city'].unique():
|
||||
community_summary_df[(community_summary_df['estate_charge_ranking'].notna()) & (community_summary_df['city'] == city)]['estate_charge_ranking'].hist(bins=100)
|
||||
pyplot.savefig(save_png_path + "/" + city + ".png")
|
||||
|
||||
|
||||
sync()
|
||||
save_png()
|
||||
nextcloudutils.up_to_nextcloud(save_png_path, nextcloud_aim_file_path)
|
||||
dingutils.send_text("【分布图生成完毕】物业费评级已完成, 请点击 https://nextcloud.fangjia.com/s/HbifLoEDc5wi8HR 查看分布图", "c7ac6c86bfbe49a95e30a68616c4d784ae7781c715430dc9c5f6b46d3e6ebd78")
|
||||
Reference in New Issue
Block a user