修改: PriceSystem/fangjia/__init__.py

修改:     PriceSystem/sell_price/zhuge0118A.py
	修改:     PriceSystem/test.py
	PriceSystem/one_Sender.py
This commit is contained in:
罗干
2018-03-20 16:48:39 +08:00
parent 3f92b527ee
commit 3e63e49d4e
3 changed files with 70 additions and 20 deletions
+5 -1
View File
@@ -39,7 +39,11 @@ def get_performance_logger(name):
logger.setLevel("INFO")
return logger
now = datetime.datetime.now().replace(hour=0, minute=0, second=0, microsecond=0)
for day in range(1, 9):
if calendar.weekday(now.year, now.month, now.day) == 6:
break
now = now + datetime.timedelta(days=1)
performance_logger = get_performance_logger("performance")
+42 -16
View File
@@ -140,7 +140,10 @@ def commonprice(ct, rl, p):
if ltt > 0:
fields1 = {"lat2": 1, "lng2": 1, "city": 1, "region": 1, "cat": 1, "name": 1}
lct = seaweed136.find(query1, fields1)
#print('lct=',lct)
lf = pandas.DataFrame(list(lct))
#print('lf=',lf)
# lf=fangjia.find_seaweed(query1, fields1)
le = lf
@@ -401,7 +404,8 @@ def commonprice(ct, rl, p):
random.shuffle(dirst1)
dirst = dirst1[:80]
dirst = dirst1[:200]
# print('dirst=',dirst)
dirst_plus = dirst + [p[0]]
@@ -472,19 +476,39 @@ def commonprice(ct, rl, p):
return int(k_means(km))
def no_source_price(ct, rl, location, p):
lk = p[0]
hg = location.shape[0]
'''
def choose_factor(p):
typ=p[2]
if typ=='普通住宅':
return 20
else:
return 5
'''
#factor=choose_factor(p)
factor=20
if hg == 0:
return '没有经纬度数据', 0
elif hg > 1:
return '纬度数据有误,有多个经纬度', 0
#elif hg > 1:
#return '纬度数据有误,有多个经纬度', 0
else:
# t1=time.time()
dd = neighbor(location['lng2'][0], location['lat2'][0], 5, ct, rl, p)
#print("location['lng2'][0]",location['lng2'].iloc[0])
dd = neighbor(location['lng2'].iloc[0], location['lat2'].iloc[0], 5, ct, rl, p)
# print(time.time()-t1,'t1'*10)
# print('dd=',dd,'dd'*20)
if dd.shape[0] >= 20:
if dd.shape[0] >= factor:
# print('$'*50)
# dd1=neighbor(location['lng2'][0],location['lat2'][0],5)
# print('dd',dd)
@@ -495,10 +519,10 @@ def commonprice(ct, rl, p):
return other, dd.shape[0]
else:
# t2=time.time()
dd1 = neighbor(location['lng2'][0], location['lat2'][0], 10, ct, rl, p)
dd1 = neighbor(location['lng2'].iloc[0], location['lat2'].iloc[0], 10, ct, rl, p)
# print(time.time()-t2,'t2'*10)
# print('dd1=',dd1)
if dd1.shape[0] >= 20:
if dd1.shape[0] >= factor:
# print('$'*50)
# svr_time=time.time()
@@ -508,10 +532,10 @@ def commonprice(ct, rl, p):
return other1, dd1.shape[0]
else:
# t3=time.time()
dd2 = neighbor(location['lng2'][0], location['lat2'][0], 50, ct, rl, p)
dd2 = neighbor(location['lng2'].iloc[0], location['lat2'].iloc[0], 50, ct, rl, p)
# print(time.time()-t3,'t3'*10)
#print('dd2.shape', dd2.shape[0], '@' * 60)
if dd2.shape[0] >= 20:
if dd2.shape[0] >= factor:
#print('$' * 50)
#svr_time = time.time()
other1 = svr(dd2, lk)
@@ -519,9 +543,9 @@ def commonprice(ct, rl, p):
# print('other1=',other1)
return other1, dd2.shape[0]
else:
dd3 = neighbor(location['lng2'][0], location['lat2'][0], 100, ct, rl, p)
dd3 = neighbor(location['lng2'].iloc[0], location['lat2'].iloc[0], 100, ct, rl, p)
# print('dd2=',dd2,'@'*60)
if dd3.shape[0] >= 20:
if dd3.shape[0] >= factor:
# svr_time=time.time()
other1 = svr(dd3, lk)
# print(time.time()-svr_time,'svr'*10)
@@ -529,11 +553,13 @@ def commonprice(ct, rl, p):
return other1, dd3.shape[0]
else:
dd6 = neighbor_km(location['lng2'][0], location['lat2'][0], 30, ct, rl, p)
dd6 = neighbor_km(location['lng2'].iloc[0], location['lat2'].iloc[0], 30, ct, rl, p)
# print('dd2=',dd2,'@'*60)
if dd6.shape[0] >= 20:
# svr_time=time.time()
other1 = svr(dd6, lk)
#print('#'*20)
# print(time.time()-svr_time,'svr'*10)
# print('other1=',other1)
return other1, dd6.shape[0]
@@ -926,7 +952,7 @@ def commonprice(ct, rl, p):
# print(time.time()-ttp,'m'*20)
junjia = dsfjujia(ct, rl, lk)
# print('junjia=',junjia)
#print('junjia=',junjia)
'''
dglg=dsplg(junjia,neighb,2)
@@ -1350,10 +1376,10 @@ def out_put_price(ct, rl, lk, weekend):
p = ghhh(lf[['name', 'alias', 'estate_type2']])[0]
#print('p=', p)
print('p=', p)
mm = commonprice(ct, rl, p)
print('mm=',mm)
c_date = datetime.datetime.utcnow()
m_date = datetime.datetime.utcnow()
estate_type = lf['estate_type2'].iloc[0]
@@ -1367,7 +1393,7 @@ def out_put_price(ct, rl, lk, weekend):
if type(mm[0]) != str:
#print(ct, rl, lk, mm, '$' * 20)
print(ct, rl, lk, mm, '$' * 20)
# print(lf['estate_type2'].iloc[0],'*'*10)
+23 -3
View File
@@ -15,12 +15,32 @@ s = time.time()
ct = '深圳'
rl = '龙岗'
lk = '葵涌供销社综合商住楼'
ct = '杭州'
rl = '桐庐'
lk = '金色港湾度假村'
ct = '成都'
rl = '武侯'
lk = '中海国际社区林汀别墅'
ct = '成都'
rl = '双流'
lk = '长滩壹号'
ct = '广州'
rl = '海珠'
lk = '会展世界城三期'
'''
#成都- 都江堰- 溪岭雪
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())