修改: PriceSystem/sell_price/zhuge0118A.py
修改: PriceSystem/test.py
This commit is contained in:
@@ -320,8 +320,11 @@ def commonprice(ct, rl, p):
|
||||
|
||||
# lf=pandas.DataFrame(lct)
|
||||
lf = fangjia.find_seaweed(query1, fields1)
|
||||
|
||||
#print('lf',lf[['estate_type2','lng2', 'lat2']])
|
||||
|
||||
le = le = lf[lf['estate_type2'] == estype]
|
||||
le = lf[lf['estate_type2'] == estype]
|
||||
#print('le',le[['estate_type2','lng2', 'lat2']])
|
||||
|
||||
le.index = le['name']
|
||||
|
||||
@@ -344,10 +347,77 @@ def commonprice(ct, rl, p):
|
||||
|
||||
# print('小区个数= ',len(dirst))
|
||||
df1 = zhoubian_xiaoqu(ct, rl, dirst)
|
||||
# print('df1=',df1,'*'*20)
|
||||
#print('df1=',df1,'*'*20)
|
||||
if df1.shape[0] > 1:
|
||||
df = new_data(df1)
|
||||
# print('df=',df)
|
||||
#print('df=',df)
|
||||
vv = hh(ppp, df)
|
||||
# print('#'*36)
|
||||
# print('vv=',vv)
|
||||
return vv
|
||||
else:
|
||||
return numpy.array([])
|
||||
|
||||
def neighbor_km(lng, lat, scale, ct, rl, p):
|
||||
|
||||
###################
|
||||
###################
|
||||
# timm=20171122
|
||||
###################
|
||||
###################
|
||||
|
||||
estype = p[2]
|
||||
# client1 = pymongo.MongoClient('192.168.0.136',27017)
|
||||
# db1 = client1.fangjia
|
||||
# seaweed1 = db1.seaweed
|
||||
kkk = scale / 1000
|
||||
longtitude = lng
|
||||
latitude = lat
|
||||
|
||||
query1 = {"status": 0, "cat": "district",
|
||||
"lat2": {"$gt": int(latitude - kkk * 10 ** 10 / 0.86), "$lt": int(latitude + kkk * 10 ** 10 / 0.86)},
|
||||
"lng2": {"$gt": int(longtitude - kkk * 10 ** 10), "$lt": int(longtitude + kkk * 10 ** 10)}}
|
||||
# fields1 = {"lat2":1,"lng2":1, "city":1,"region":1,"cat":1,"name":1}
|
||||
|
||||
fields1 = {"lat2": 1, "lng2": 1, "city": 1, "region": 1,
|
||||
"cat": 1, "name": 1, 'estate_type2': 1}
|
||||
|
||||
# lct= list( seaweed136.find(query1, fields1))
|
||||
|
||||
# lf=pandas.DataFrame(lct)
|
||||
lf = fangjia.find_seaweed(query1, fields1)
|
||||
|
||||
#print('lf',lf[['estate_type2','lng2', 'lat2']])
|
||||
|
||||
#le = lf[lf['estate_type2'] == estype]
|
||||
le = lf
|
||||
#print('le',le[['estate_type2','lng2', 'lat2']])
|
||||
|
||||
le.index = le['name']
|
||||
|
||||
lr = le[['lng2', 'lat2']]
|
||||
|
||||
dirst1 = list(lr.index)
|
||||
|
||||
random.shuffle(dirst1)
|
||||
|
||||
dirst = dirst1[:80]
|
||||
# print('dirst=',dirst)
|
||||
|
||||
dirst_plus = dirst + [p[0]]
|
||||
|
||||
query_feature = {"city": ct, "region": rl,
|
||||
"district_name": {"$in": dirst_plus}}
|
||||
|
||||
ppp = fangjia.dis_feature(query_feature)
|
||||
# print('ox'*10,ppp)
|
||||
|
||||
# print('小区个数= ',len(dirst))
|
||||
df1 = zhoubian_xiaoqu(ct, rl, dirst)
|
||||
#print('df1=',df1,'*'*20)
|
||||
if df1.shape[0] > 1:
|
||||
df = new_data(df1)
|
||||
#print('df=',df)
|
||||
vv = hh(ppp, df)
|
||||
# print('#'*36)
|
||||
# print('vv=',vv)
|
||||
@@ -440,12 +510,12 @@ def commonprice(ct, rl, p):
|
||||
# t3=time.time()
|
||||
dd2 = neighbor(location['lng2'][0], location['lat2'][0], 50, ct, rl, p)
|
||||
# print(time.time()-t3,'t3'*10)
|
||||
print('dd2.shape', dd2.shape[0], '@' * 60)
|
||||
#print('dd2.shape', dd2.shape[0], '@' * 60)
|
||||
if dd2.shape[0] >= 20:
|
||||
print('$' * 50)
|
||||
svr_time = time.time()
|
||||
#print('$' * 50)
|
||||
#svr_time = time.time()
|
||||
other1 = svr(dd2, lk)
|
||||
print(time.time() - svr_time, 'e' * 10)
|
||||
#print(time.time() - svr_time, 'e' * 10)
|
||||
# print('other1=',other1)
|
||||
return other1, dd2.shape[0]
|
||||
else:
|
||||
@@ -458,8 +528,17 @@ def commonprice(ct, rl, p):
|
||||
# print('other1=',other1)
|
||||
return other1, dd3.shape[0]
|
||||
else:
|
||||
|
||||
return '没有周围小区数据', 0
|
||||
|
||||
dd6 = neighbor_km(location['lng2'][0], location['lat2'][0], 30, ct, rl, p)
|
||||
# print('dd2=',dd2,'@'*60)
|
||||
if dd6.shape[0] >= 20:
|
||||
# svr_time=time.time()
|
||||
other1 = svr(dd6, lk)
|
||||
# print(time.time()-svr_time,'svr'*10)
|
||||
# print('other1=',other1)
|
||||
return other1, dd6.shape[0]
|
||||
else:
|
||||
return '没有周围小区数据', 0
|
||||
|
||||
def region_district_list(ct, rl):
|
||||
# import pandas
|
||||
@@ -837,6 +916,8 @@ def commonprice(ct, rl, p):
|
||||
|
||||
lk = p[0]
|
||||
location = take_location(ct, rl, p)
|
||||
|
||||
#print('location',location)
|
||||
|
||||
# ttp=time.time()
|
||||
|
||||
@@ -936,20 +1017,21 @@ def commonprice(ct, rl, p):
|
||||
# print('链家和诸葛找房合并后的数据集=',gdf)
|
||||
sample_size = len(gdf)
|
||||
gm = k_means_clus(gdf, 2)
|
||||
print('链猪= ', gm)
|
||||
#print('链猪= ', gm)
|
||||
return int(gm), float('%.2f' % credit['0.8']), value_type['自身样本'], sample_size # 优质样本
|
||||
|
||||
|
||||
elif data.shape[0] > 0:
|
||||
|
||||
print('诸葛找房算法')
|
||||
#print('诸葛找房算法')
|
||||
#print('neighb',neighb)
|
||||
# from zhuge import zhuge_consist
|
||||
data['avg'] = data['total_price'] / data['area']
|
||||
|
||||
def guolv_data11(data, neighb):
|
||||
if type(neighb) is not str:
|
||||
|
||||
print('周边价格=', neighb)
|
||||
#print('周边价格=', neighb)
|
||||
ddd11 = data[data['avg'] > 0.5 * neighb]
|
||||
return ddd11
|
||||
else:
|
||||
@@ -975,7 +1057,7 @@ def commonprice(ct, rl, p):
|
||||
# print('s=',s)
|
||||
|
||||
def compelex(ddd11, s, neighb, junjia):
|
||||
# cc1 = ddd11['avg'].dropna()
|
||||
#cc1 = ddd11['avg'].dropna()
|
||||
|
||||
# print('cc1=',cc1)
|
||||
|
||||
@@ -1005,8 +1087,10 @@ def commonprice(ct, rl, p):
|
||||
return junjia
|
||||
|
||||
junjia1 = drop_ganji(junjia)
|
||||
|
||||
#print('ddd11',ddd11)
|
||||
|
||||
# print('junjia_ganji=',junjia1,'$'*100)
|
||||
#print('junjia_ganji=',junjia1,'$'*100)
|
||||
cc = group(junjia_front, junjia1, 1)
|
||||
# junjia_km=k_means(junjia)
|
||||
# print('cc=',cc)
|
||||
@@ -1274,6 +1358,9 @@ def out_put_price(ct, rl, lk, weekend):
|
||||
m_date = datetime.datetime.utcnow()
|
||||
estate_type = lf['estate_type2'].iloc[0]
|
||||
|
||||
|
||||
#print('estate_type',estate_type)
|
||||
|
||||
|
||||
estate_type,cmd_estate_type = out_estate_type(estate_type)
|
||||
|
||||
@@ -1304,6 +1391,7 @@ def out_put_price(ct, rl, lk, weekend):
|
||||
make_up = int(make_up())
|
||||
|
||||
#print('make_up',make_up,'*'*20)
|
||||
#print('credic',mm[1])
|
||||
|
||||
try:
|
||||
|
||||
|
||||
+4
-4
@@ -9,10 +9,10 @@ import sell_price.zhuge0118A as sellPrice
|
||||
s = time.time()
|
||||
|
||||
#上海 闵行上海康城
|
||||
|
||||
ct = '上海'
|
||||
rl = '闵行'
|
||||
lk = '上海康城'
|
||||
#深圳龙岗葵涌供销社综合商住楼
|
||||
ct = '深圳'
|
||||
rl = '龙岗'
|
||||
lk = '葵涌供销社综合商住楼'
|
||||
#weekend = datetime.datetime.strptime("2018-03-11", "%Y-%m-%d")
|
||||
#for i in range(0, 100):
|
||||
sellPrice.out_put_price(ct, rl, lk, fangjia.get_weekend())
|
||||
|
||||
Reference in New Issue
Block a user