修改: PriceSystem/sell_price/zhuge0118A.py

This commit is contained in:
罗干
2018-06-05 11:01:10 +08:00
parent d9edd19912
commit 1e012e0759
+22 -10
View File
@@ -321,6 +321,7 @@ def commonprice(ct, rl, p,weekend):
return ppp
#搜索周边小区,并且输出周边小区的房价
#在提取周边小区时,按照距离远近进行排序,距离的定义是曼哈顿距离
@timer
def neighbor(lng, lat, scale, ct, rl, p):
@@ -353,7 +354,8 @@ def commonprice(ct, rl, p,weekend):
lf = fangjia.find_seaweed(query1, fields1)
######print('lf',lf[['estate_type2','lng2', 'lat2']])
#在提取周边小区时需要考虑小区的物业类型
le = lf[lf['estate_type2'] == estype]
######print(le['name'])
@@ -386,7 +388,8 @@ def commonprice(ct, rl, p,weekend):
dirst1 = list(lr1[:,2])
#random.shuffle(dirst1)
#提取周边的80个小区
dirst = dirst1[:80]
######print('dirst=',dirst)
@@ -410,7 +413,10 @@ def commonprice(ct, rl, p,weekend):
return vv
else:
return numpy.array([])
#本函数与上一个函数基本相同,仅仅缺少一行代码,le = lf[lf['estate_type2'] == estype]
#读取周边小区价格,不考虑其物业类型,原因是别墅或商住楼周边的同物业类型的小区非常少
#故而提取周边小区时不考虑其物业类型
def neighbor_km(lng, lat, scale, ct, rl, p):
###################
@@ -617,7 +623,7 @@ def commonprice(ct, rl, p,weekend):
return other1, dd2.shape[0]
else:
#不考虑物业类型
dd6 = neighbor_km(location['lng2'].iloc[0], location['lat2'].iloc[0], 20, ct, rl, p)
##print('dd2=',dd2,'@'*60)
if dd6.shape[0] >= 3:
@@ -646,6 +652,7 @@ def commonprice(ct, rl, p,weekend):
lf = fangjia.find_seaweed(query1, fields1)
return lf
#聚类算法
def k_means(pp1):
from sklearn.cluster import KMeans
pv = list(pp1)
@@ -665,7 +672,7 @@ def commonprice(ct, rl, p,weekend):
return (int(center))
else:
return int(pp1.mean())
def region_district_list_name(ct, rl, lkk):
# import pandas
# client1 = pymongo.MongoClient('192.168.0.136',27017)
@@ -681,7 +688,7 @@ def commonprice(ct, rl, p,weekend):
# lf=pandas.DataFrame(lct)
lf = fangjia.find_seaweed(query1, fields1)
return lf
def strip_villa(ct, rl, p):
lw = p[0]
# estype=p[2]
@@ -1045,7 +1052,7 @@ def commonprice(ct, rl, p,weekend):
dg22 = middle_operate(junjia_lzf, junjia_anst)
return junjia_max(mmax,dg22)
#由于链家和诸葛找房的数据准确度比较高,增加链家和诸葛找房数据的权重,即放大20倍.
def add_weight(s1):
choose_columns=['url','area', 'district_name', 'name', 'p_date', 'region',
@@ -1079,7 +1086,8 @@ def commonprice(ct, rl, p,weekend):
return d1
else:
return s1
#在第三方 均价中安居客的价格和赶集网的价格大概率的相同,在采用第三方均价计算价格时如果
#赶集和安居客几乎相同并且和其他数据不同,就drop赶集网 的均价
def drop_ganji(junjia):
a = {'ganji_esf_price', 'anjuke_esf_price'}
# #####print('a=',a)
@@ -1100,16 +1108,18 @@ def commonprice(ct, rl, p,weekend):
else:
return junjia
lk = p[0]
#本小区的经纬度
location = take_location(ct, rl, p)
######print('location',location)
# ttp=time.time()
#本小区的周边价格(向量回归或者聚类)
neighb = no_source_price(ct, rl, location, p)
# #####print(time.time()-ttp,'m'*20)
#本小区的第三方均价
junjia = dsfjujia(ct, rl, lk)
print('junjia=',junjia)
#print('neighb=',neighb)
@@ -1119,6 +1129,8 @@ def commonprice(ct, rl, p,weekend):
dggg=dsplg(junjia,neighb,1)
'''
#在第三方 均价中安居客的价格和赶集网的价格大概率的相同,在采用第三方均价计算价格时如果
#赶集和安居客几乎相同并且和其他数据不同,就drop赶集网 的均价
judp=drop_ganji(junjia)
dglg = dglg_out1(judp, neighb[0])