Commit 7720cec8 authored by Shawn You's avatar Shawn You 💬

增加画图

parent 441bde99
......@@ -128,7 +128,7 @@ print ("Local current time :", time.asctime( time.localtime(time.time()) ))
# 评估在售房价
#================
predictResult = list(estimator.predict(xs_predict))
df = pd.DataFrame(predictResult)
df = pd.DataFrame({'price': predictResult})
df = df.reset_index()
df.to_json(path_or_buf=_0_config.resultDataPath)
#print("predictL%r"% predictResult)
......
......@@ -2,5 +2,45 @@
# Arthor: YouShaohua
# Date : Sep. 15 2017
# 此文件用于画图
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.font_manager import FontManager, FontProperties
import _0_config
def getChineseFont():
return FontProperties(fname='/System/Library/Fonts/PingFang.ttc')
#=====================================
# 此文件用于画图,比较挂牌价格和评估价格
#=====================================
# 读取挂牌价格
evaling = pd.read_json(path_or_buf=_0_config.predictDataPath)
evaling_price = evaling['price']
# 读取模型评估价格
evaled= pd.read_json(path_or_buf=_0_config.resultDataPath)
evaled_price = evaled.price
# 画图
rowLen = len(evaled_price)
x_list = np.arange(rowLen) + 1
font = {
'family': 'serif',
'color': 'dark',
'weight': 'normal',
'size': 16,
}
plt.title('重庆市二手房价格评估(30间)', fontproperties=getChineseFont())
plt.xlabel('房子', fontproperties=getChineseFont())
plt.ylabel('房价', fontproperties=getChineseFont())
plt.plot(x_list,evaling_price)
plt.plot(x_list, evaled_price)
plt.show()
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment