Merge branch 'master' of 192.168.0.27:dev0/PriceSystem
# Conflicts: # PriceSystem/test.py
This commit is contained in:
@@ -25,7 +25,7 @@ def get_logger(name):
|
||||
file_handler = logging.FileHandler("/home/goojia/logs/" + name + ".log")
|
||||
file_handler.setFormatter(formatter)
|
||||
logger.addHandler(file_handler)
|
||||
logger.setLevel("ERROR")
|
||||
logger.setLevel("INFO")
|
||||
|
||||
return logger
|
||||
|
||||
@@ -39,7 +39,7 @@ def get_performance_logger(name):
|
||||
file_handler = logging.FileHandler("/home/goojia/logs/" + name + ".performance.log")
|
||||
file_handler.setFormatter(formatter)
|
||||
logger.addHandler(file_handler)
|
||||
logger.setLevel("ERROR")
|
||||
logger.setLevel("INFO")
|
||||
|
||||
return logger
|
||||
now = datetime.datetime.now().replace(hour=0, minute=0, second=0, microsecond=0)
|
||||
|
||||
@@ -21,6 +21,7 @@ import pymongo
|
||||
import sklearn.cluster
|
||||
import pandas
|
||||
import numpy
|
||||
import numpy as np
|
||||
import time
|
||||
import fangjia
|
||||
import sklearn.svm
|
||||
@@ -296,13 +297,13 @@ def commonprice(ct, rl, p):
|
||||
|
||||
@timer
|
||||
def neighbor(lng, lat, scale, ct, rl, p):
|
||||
|
||||
|
||||
###################
|
||||
###################
|
||||
# timm=20171122
|
||||
###################
|
||||
###################
|
||||
|
||||
|
||||
estype = p[2]
|
||||
# client1 = pymongo.MongoClient('192.168.0.136',27017)
|
||||
# db1 = client1.fangjia
|
||||
@@ -310,44 +311,64 @@ def commonprice(ct, rl, p):
|
||||
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]
|
||||
#print('le',le[['estate_type2','lng2', 'lat2']])
|
||||
|
||||
#print(le['name'])
|
||||
|
||||
le.index = le['name']
|
||||
|
||||
|
||||
lr = le[['lng2', 'lat2']]
|
||||
|
||||
dirst1 = list(lr.index)
|
||||
|
||||
random.shuffle(dirst1)
|
||||
|
||||
lr['name1']=le['name']
|
||||
|
||||
|
||||
def sort_manhaten(lr):
|
||||
lr1=lr.values
|
||||
lr2=[]
|
||||
|
||||
for m in range(lr1.shape[0]):
|
||||
#print(m)
|
||||
distance=abs(lng-lr1[m][0])+abs(lat-lr1[m][1])
|
||||
lr2.append(distance/100000)
|
||||
|
||||
lr3=np.c_[lr1,lr2]
|
||||
lrr=lr3[lr3[:,3].argsort()]
|
||||
|
||||
|
||||
return lrr
|
||||
|
||||
|
||||
lr1=sort_manhaten(lr)
|
||||
|
||||
dirst1 = list(lr1[:,3])
|
||||
|
||||
#random.shuffle(dirst1)
|
||||
|
||||
dirst = dirst1[:80]
|
||||
# print('dirst=',dirst)
|
||||
|
||||
#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('ox'*10,ppp)
|
||||
|
||||
# print('小区个数= ',len(dirst))
|
||||
df1 = zhoubian_xiaoqu(ct, rl, dirst)
|
||||
#print('df1=',df1,'*'*20)
|
||||
@@ -356,7 +377,7 @@ def commonprice(ct, rl, p):
|
||||
#print('df=',df)
|
||||
vv = hh(ppp, df)
|
||||
# print('#'*36)
|
||||
# print('vv=',vv)
|
||||
#print('vv=',vv)
|
||||
return vv
|
||||
else:
|
||||
return numpy.array([])
|
||||
@@ -397,6 +418,7 @@ def commonprice(ct, rl, p):
|
||||
#print('le',le[['estate_type2','lng2', 'lat2']])
|
||||
|
||||
le.index = le['name']
|
||||
print('EEEEEEEEE')
|
||||
|
||||
lr = le[['lng2', 'lat2']]
|
||||
|
||||
@@ -1352,104 +1374,105 @@ def pt_up(ct, rl, p, weekend, c_date, cmd_estate_type):
|
||||
@timer
|
||||
def out_put_price(ct, rl, lk, weekend):
|
||||
lf = region_district_list_lk(ct, rl, lk)
|
||||
lf = add_alias(lf)
|
||||
p = ghhh(lf[['name', 'alias', 'estate_type2']])[0]
|
||||
|
||||
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]
|
||||
if lf.shape[0]>0:
|
||||
lf = add_alias(lf)
|
||||
p = ghhh(lf[['name', 'alias', 'estate_type2']])[0]
|
||||
|
||||
#print('p=', p)
|
||||
|
||||
#print('estate_type',estate_type)
|
||||
|
||||
|
||||
estate_type,cmd_estate_type = out_estate_type(estate_type)
|
||||
|
||||
|
||||
if type(mm[0]) != str:
|
||||
|
||||
print(ct, rl, lk, mm, '$' * 20)
|
||||
# print(lf['estate_type2'].iloc[0],'*'*10)
|
||||
|
||||
|
||||
# last_sunday=last_sunday()
|
||||
# t1=time.time()
|
||||
last_sunday_price = make_up_price(ct, rl, lk, weekend)
|
||||
|
||||
# print(time.time()-t1,'*'*20)
|
||||
|
||||
# print('last_sunday_price',last_sunday_price)
|
||||
# print('mm[0]',mm[0])
|
||||
|
||||
def make_up():
|
||||
if type(last_sunday_price) != str and last_sunday_price != None and mm[0] != None and type(mm[0]) != str:
|
||||
|
||||
make_up = 10000 * (mm[0] - last_sunday_price) / last_sunday_price
|
||||
return make_up
|
||||
else:
|
||||
return 0
|
||||
|
||||
make_up = int(make_up())
|
||||
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]
|
||||
|
||||
#print('make_up',make_up,'*'*20)
|
||||
#print('credic',mm[1])
|
||||
|
||||
try:
|
||||
|
||||
#print('estate_type',estate_type)
|
||||
|
||||
|
||||
estate_type,cmd_estate_type = out_estate_type(estate_type)
|
||||
|
||||
|
||||
if type(mm[0]) != str:
|
||||
|
||||
print(ct, rl, lk, mm, '$' * 20)
|
||||
# print(lf['estate_type2'].iloc[0],'*'*10)
|
||||
|
||||
|
||||
# last_sunday=last_sunday()
|
||||
# t1=time.time()
|
||||
last_sunday_price = make_up_price(ct, rl, lk, weekend)
|
||||
|
||||
# print(time.time()-t1,'*'*20)
|
||||
|
||||
# print('last_sunday_price',last_sunday_price)
|
||||
# print('mm[0]',mm[0])
|
||||
|
||||
def make_up():
|
||||
if type(last_sunday_price) != str and last_sunday_price != None and mm[0] != None and type(mm[0]) != str:
|
||||
|
||||
make_up = 10000 * (mm[0] - last_sunday_price) / last_sunday_price
|
||||
return make_up
|
||||
else:
|
||||
return 0
|
||||
|
||||
make_up = int(make_up())
|
||||
|
||||
stat_save(ct,rl,p,weekend,mm,c_date,m_date,make_up,estate_type)
|
||||
pt_up(ct,rl,p,weekend,c_date,cmd_estate_type)
|
||||
|
||||
#print('make_up',make_up,'*'*20)
|
||||
#print('credic',mm[1])
|
||||
|
||||
try:
|
||||
|
||||
stat_save(ct,rl,p,weekend,mm,c_date,m_date,make_up,estate_type)
|
||||
pt_up(ct,rl,p,weekend,c_date,cmd_estate_type)
|
||||
|
||||
'''
|
||||
stat.replace_one(
|
||||
|
||||
{"city": ct, "region": rl, "district_name": p[0], "weekend": weekend},
|
||||
|
||||
{"city": ct, "region": rl, "district_name": p[0], 'credit': mm[1],
|
||||
"calc_value": int(mm[0]), "weekend": weekend, "c_date": c_date, 'avg_price': int(mm[0]),
|
||||
"m_date": m_date, 'value_type': int(mm[2]), 'weekend_markup': make_up,
|
||||
'changed_markup': make_up, 'markup': make_up, 'sample_size': mm[3],
|
||||
'estate_type': estate_type}, True
|
||||
)
|
||||
|
||||
|
||||
|
||||
pt.replace_one(
|
||||
|
||||
{"city": ct, "region": rl, "name": p[0], "calc_date": weekend},
|
||||
|
||||
{"city": ct, "region": rl, "name": p[0], "c_date": c_date, 'status': int(102),
|
||||
'remark': 'week', 'category': 'sell', "calc_date": weekend, 'priority': int(0),
|
||||
'estate_type': cmd_estate_type, 'problem': None, "calc_type": int(0)
|
||||
}, True
|
||||
)
|
||||
'''
|
||||
|
||||
|
||||
except:
|
||||
stat_save(ct,rl,p,weekend,mm,c_date,m_date,make_up,estate_type)
|
||||
|
||||
|
||||
|
||||
|
||||
else:
|
||||
|
||||
pt_down(ct,rl,p,weekend,c_date,cmd_estate_type,mm)
|
||||
'''
|
||||
stat.replace_one(
|
||||
|
||||
{"city": ct, "region": rl, "district_name": p[0], "weekend": weekend},
|
||||
|
||||
{"city": ct, "region": rl, "district_name": p[0], 'credit': mm[1],
|
||||
"calc_value": int(mm[0]), "weekend": weekend, "c_date": c_date, 'avg_price': int(mm[0]),
|
||||
"m_date": m_date, 'value_type': int(mm[2]), 'weekend_markup': make_up,
|
||||
'changed_markup': make_up, 'markup': make_up, 'sample_size': mm[3],
|
||||
'estate_type': estate_type}, True
|
||||
)
|
||||
|
||||
|
||||
|
||||
pt.replace_one(
|
||||
|
||||
|
||||
{"city": ct, "region": rl, "name": p[0], "calc_date": weekend},
|
||||
|
||||
{"city": ct, "region": rl, "name": p[0], "c_date": c_date, 'status': int(102),
|
||||
|
||||
{"city": ct, "region": rl, "name": p[0], "c_date": c_date, 'status': int(3),
|
||||
'remark': 'week', 'category': 'sell', "calc_date": weekend, 'priority': int(0),
|
||||
'estate_type': cmd_estate_type, 'problem': None, "calc_type": int(0)
|
||||
'problem': mm[0], 'estate_type': cmd_estate_type, "calc_type": int(0)
|
||||
}, True
|
||||
)
|
||||
'''
|
||||
|
||||
|
||||
except:
|
||||
stat_save(ct,rl,p,weekend,mm,c_date,m_date,make_up,estate_type)
|
||||
|
||||
|
||||
|
||||
|
||||
else:
|
||||
|
||||
pt_down(ct,rl,p,weekend,c_date,cmd_estate_type,mm)
|
||||
'''
|
||||
pt.replace_one(
|
||||
|
||||
{"city": ct, "region": rl, "name": p[0], "calc_date": weekend},
|
||||
|
||||
{"city": ct, "region": rl, "name": p[0], "c_date": c_date, 'status': int(3),
|
||||
'remark': 'week', 'category': 'sell', "calc_date": weekend, 'priority': int(0),
|
||||
'problem': mm[0], 'estate_type': cmd_estate_type, "calc_type": int(0)
|
||||
}, True
|
||||
)
|
||||
'''
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
+80
-83
@@ -1,84 +1,81 @@
|
||||
import pandas as pd
|
||||
import numpy as np
|
||||
import datetime
|
||||
import fangjia
|
||||
#fangjia.send_dingding_msg("测试")
|
||||
|
||||
# import datetime
|
||||
# import fangjia
|
||||
# #fangjia.send_dingding_msg("测试")
|
||||
#
|
||||
# import time
|
||||
#
|
||||
# import sell_price.zhuge0118A as sellPrice
|
||||
#
|
||||
# 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-04-01", "%Y-%m-%d")
|
||||
# #for i in range(0, 100):
|
||||
#
|
||||
# sellPrice.out_put_price(ct, rl, lk, weekend)
|
||||
# e = time.time()
|
||||
#
|
||||
# print(e - s)
|
||||
# '''
|
||||
# ###
|
||||
# import pandas as pd
|
||||
#
|
||||
# a=pd.read_csv('fangjia.seaweed.csv')
|
||||
#
|
||||
# for i in a.index:
|
||||
# ct=a['city'][i]
|
||||
# rl=a['region'][i]
|
||||
# lk=a['name'][i]
|
||||
# sellPrice.out_put_price(ct, rl, lk, weekend)
|
||||
#
|
||||
# '''
|
||||
# '''
|
||||
#
|
||||
# @fangjia.cache(1000)
|
||||
# def sum1(a, b):
|
||||
# print(111)
|
||||
# return a + b
|
||||
#
|
||||
#
|
||||
# print(sum1(1,2))
|
||||
# '''
|
||||
import execjs
|
||||
import time
|
||||
|
||||
import sell_price.zhuge0118A as sellPrice
|
||||
|
||||
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-04-01", "%Y-%m-%d")
|
||||
#for i in range(0, 100):
|
||||
|
||||
sellPrice.out_put_price(ct, rl, lk, weekend)
|
||||
e = time.time()
|
||||
|
||||
print(e - s)
|
||||
'''
|
||||
###
|
||||
import pandas as pd
|
||||
|
||||
a=pd.read_csv('fangjia.seaweed.csv')
|
||||
|
||||
for i in a.index:
|
||||
ct=a['city'][i]
|
||||
rl=a['region'][i]
|
||||
lk=a['name'][i]
|
||||
sellPrice.out_put_price(ct, rl, lk, weekend)
|
||||
|
||||
'''
|
||||
'''
|
||||
|
||||
@fangjia.cache(1000)
|
||||
def sum1(a, b):
|
||||
print(111)
|
||||
return a + b
|
||||
|
||||
|
||||
print(sum1(1,2))
|
||||
'''
|
||||
|
||||
Reference in New Issue
Block a user