修复评级bug
This commit is contained in:
@@ -10,7 +10,6 @@ from elasticsearch import helpers
|
||||
import matplotlib.pyplot as plt
|
||||
|
||||
from sklearn.mixture import GaussianMixture
|
||||
from matplotlib import pyplot
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
@@ -180,48 +179,48 @@ def filter_min_max(city, community_summary_df):
|
||||
return community_summary_df
|
||||
|
||||
|
||||
def save_png(city=None):
|
||||
def save_png(city):
|
||||
"""
|
||||
生成财力评级图表
|
||||
"""
|
||||
sql = "select id, city, region, name, total_price, estate_charge, avg_cost, relative_price_ranking, consumption_rating from community_summary"
|
||||
if pd.notna(city):
|
||||
sql += " where city='" + city + "'"
|
||||
sql = "select id, city, region, name, total_price, estate_charge, avg_cost, relative_price_ranking, consumption_rating from community_summary where city='" + city + "'"
|
||||
community_summary_df = es206_client.scan_by_sql_to_data_frame(sql)
|
||||
community_summary_df['total_price'] = community_summary_df['total_price'] / 10000
|
||||
|
||||
for city in community_summary_df['city'].unique():
|
||||
community_city = community_summary_df[community_summary_df['city'] == city]
|
||||
community_city = filter_min_max(city, community_city).copy()
|
||||
community_city = filter_min_max(city, community_summary_df).copy()
|
||||
|
||||
plt.subplot(3, 1, 1)
|
||||
community_city['consumption_rating'].hist(bins=100)
|
||||
plt.xlabel('consumption_rating')
|
||||
plt.tight_layout()
|
||||
plt.subplot(3, 1, 1)
|
||||
community_city['consumption_rating'].hist(bins=100)
|
||||
plt.xlabel('consumption_rating')
|
||||
plt.tight_layout()
|
||||
|
||||
plt.subplot(3, 2, 3)
|
||||
community_city['total_price'].hist(bins=100)
|
||||
plt.xlabel('total_price')
|
||||
plt.tight_layout()
|
||||
plt.subplot(3, 2, 3)
|
||||
community_city['total_price'].hist(bins=100)
|
||||
plt.xlabel('total_price')
|
||||
plt.tight_layout()
|
||||
|
||||
plt.subplot(3, 2, 4)
|
||||
community_city['estate_charge'].hist(bins=100)
|
||||
plt.xlabel('estate_charge')
|
||||
plt.tight_layout()
|
||||
plt.subplot(3, 2, 4)
|
||||
community_city['estate_charge'].hist(bins=100)
|
||||
plt.xlabel('estate_charge')
|
||||
plt.tight_layout()
|
||||
|
||||
plt.subplot(3, 2, 5)
|
||||
community_city['avg_cost'].hist(bins=100)
|
||||
plt.xlabel('avg_cost')
|
||||
plt.tight_layout()
|
||||
plt.subplot(3, 2, 5)
|
||||
community_city['avg_cost'].hist(bins=100)
|
||||
plt.xlabel('avg_cost')
|
||||
plt.tight_layout()
|
||||
|
||||
plt.subplot(3, 2, 6)
|
||||
community_city['relative_price_ranking'].hist(bins=100)
|
||||
plt.xlabel('relative_price_ranking')
|
||||
plt.tight_layout()
|
||||
|
||||
plt.savefig(save_png_path + "/" + city + ".png")
|
||||
plt.show()
|
||||
plt.subplot(3, 2, 6)
|
||||
community_city['relative_price_ranking'].hist(bins=100)
|
||||
plt.xlabel('relative_price_ranking')
|
||||
plt.tight_layout()
|
||||
|
||||
plt.savefig(save_png_path + "/" + city + ".png")
|
||||
# 清图
|
||||
plt.clf()
|
||||
# 清坐标轴
|
||||
plt.cla()
|
||||
# 关窗口
|
||||
plt.close()
|
||||
|
||||
sync()
|
||||
dingutils.send_text("【分布图生成完毕】财力评级已完成, 请点击 https://nextcloud.fangjia.com/s/gNTqRqnEnsYkJc4 查看分布图", "c7ac6c86bfbe49a95e30a68616c4d784ae7781c715430dc9c5f6b46d3e6ebd78")
|
||||
#dingutils.send_text("【分布图生成完毕】财力评级已完成, 请点击 https://nextcloud.fangjia.com/s/gNTqRqnEnsYkJc4 查看分布图", "c7ac6c86bfbe49a95e30a68616c4d784ae7781c715430dc9c5f6b46d3e6ebd78")
|
||||
|
||||
Reference in New Issue
Block a user