优化均价算法
This commit is contained in:
@@ -63,7 +63,7 @@ def get_seawater_index_name(city, region):
|
||||
return es.get_index_name(city, region)
|
||||
|
||||
|
||||
@timer
|
||||
|
||||
def findHouse(query, fields=None):
|
||||
# s = time.time()
|
||||
seawater105 = get_collection("fangjia", "seawater", config.get_seawater_host(), 27777)
|
||||
@@ -76,7 +76,7 @@ def findHouse(query, fields=None):
|
||||
# print('flag1')
|
||||
lt = 1000
|
||||
# seawater.find(query,{"p_date":-1}).sort([("p_date",-1)])
|
||||
pos = list(seawater105.find(query).limit(lt))
|
||||
pos = list(seawater105.find(query, fields).limit(lt))
|
||||
data = pandas.DataFrame(pos)
|
||||
del pos
|
||||
# print("==================>", time.time() - s)
|
||||
@@ -91,8 +91,8 @@ def findHouse(query, fields=None):
|
||||
raise Exception("样本查询失败!")
|
||||
|
||||
|
||||
@timer
|
||||
def find_house_from_elastic_search(city, region, alias, roots=None, pdate=None, cat="sell", limit=100):
|
||||
|
||||
def find_house_from_elastic_search(city, region, alias, roots=None, pdate=None, cat="sell", limit=1000):
|
||||
index_name = get_seawater_index_name(city, region)
|
||||
|
||||
routing_set = [cat + "_" + city + "_" + region + "_" + alia for alia in alias]
|
||||
@@ -132,7 +132,7 @@ def find_house_from_elastic_search(city, region, alias, roots=None, pdate=None,
|
||||
return pandas.DataFrame([doc["_source"] for doc in response["hits"]["hits"]])
|
||||
|
||||
|
||||
@timer
|
||||
|
||||
def find_sample_pool(query, fields=None):
|
||||
# s = time.time()
|
||||
seawater105 = get_collection("fangjia", "seawater", config.get_seawater_host(), 27777)
|
||||
@@ -221,7 +221,7 @@ def dis_feature(query, fields=None):
|
||||
|
||||
raise Exception("yang ben cha xun shi bai1")
|
||||
|
||||
@timer
|
||||
|
||||
def find_seaweed(query, fields=None):
|
||||
# dirlt=p[0]
|
||||
|
||||
|
||||
@@ -51,8 +51,6 @@ dsfjujia_time = front_step_time(430) // 100
|
||||
# 存到数据库的日期
|
||||
|
||||
|
||||
|
||||
|
||||
# date="2018-02-04"
|
||||
############################################################
|
||||
############################################################
|
||||
@@ -65,7 +63,7 @@ value_type = pandas.Series([1, 2, 3, 4, 5, 6, 7],
|
||||
|
||||
# 1:指导价 2:自身样本 3:第三方 4:交易数据 5:周边楼盘, 6:推导
|
||||
|
||||
@timer
|
||||
|
||||
def commonprice(ct, rl, p):
|
||||
def add_block(ppd):
|
||||
if 'block' not in ppd.columns:
|
||||
@@ -77,6 +75,7 @@ def commonprice(ct, rl, p):
|
||||
ppd['room'] = 2
|
||||
return ppd
|
||||
|
||||
@timer
|
||||
def some_district_information(ct, rl, lk):
|
||||
|
||||
query = {"city": ct, "cat": "sell", "region": rl,
|
||||
@@ -85,7 +84,7 @@ def commonprice(ct, rl, p):
|
||||
|
||||
# ['total_price', 'area', 'region', 'district_name', 'url', 'block', 'p_date']
|
||||
|
||||
fields1 = {'total_price':1, 'area':1, 'region':1, 'district_name':1, 'url':1, 'p_date':1}
|
||||
fields1 = {'total_price': 1, 'area': 1, 'region': 1, 'district_name': 1, 'url': 1, 'p_date': 1, "name": 1}
|
||||
|
||||
return fangjia.findHouse(query, fields1)
|
||||
"""
|
||||
@@ -121,7 +120,7 @@ def commonprice(ct, rl, p):
|
||||
return numpy.array([])
|
||||
else:
|
||||
return numpy.array([])
|
||||
@timer
|
||||
|
||||
def take_location(ct, rl, p):
|
||||
|
||||
dirlt = p[0]
|
||||
@@ -226,6 +225,7 @@ def commonprice(ct, rl, p):
|
||||
aa.append(i)
|
||||
return set(aa)
|
||||
|
||||
@timer
|
||||
def new_data(ds):
|
||||
bb = set(ds['name'])
|
||||
bb1 = list(bb)
|
||||
@@ -399,7 +399,7 @@ def commonprice(ct, rl, p):
|
||||
else:
|
||||
km = vv['price'].dropna()
|
||||
return int(k_means(km))
|
||||
@timer
|
||||
|
||||
def no_source_price(ct, rl, location, p):
|
||||
lk = p[0]
|
||||
hg = location.shape[0]
|
||||
@@ -567,6 +567,7 @@ def commonprice(ct, rl, p):
|
||||
return cc1
|
||||
else:
|
||||
return cc1
|
||||
|
||||
@timer
|
||||
def consider_villa(ct, rl, p):
|
||||
|
||||
@@ -622,7 +623,6 @@ def commonprice(ct, rl, p):
|
||||
|
||||
return villa
|
||||
|
||||
@timer
|
||||
def dsfjujia(ct, rl, lk):
|
||||
|
||||
query = {"city": ct, "region": rl,
|
||||
@@ -788,7 +788,6 @@ def commonprice(ct, rl, p):
|
||||
|
||||
return lzf, anst
|
||||
|
||||
@timer
|
||||
def dglg_out1(junjia, neighb):
|
||||
|
||||
"""
|
||||
@@ -945,7 +944,7 @@ def commonprice(ct, rl, p):
|
||||
print('诸葛找房算法')
|
||||
# from zhuge import zhuge_consist
|
||||
data['avg'] = data['total_price'] / data['area']
|
||||
@timer
|
||||
|
||||
def guolv_data11(data, neighb):
|
||||
if type(neighb) is not str:
|
||||
|
||||
@@ -1004,7 +1003,6 @@ def commonprice(ct, rl, p):
|
||||
else:
|
||||
return junjia
|
||||
|
||||
|
||||
junjia1 = drop_ganji(junjia)
|
||||
|
||||
# print('junjia_ganji=',junjia1,'$'*100)
|
||||
@@ -1084,7 +1082,7 @@ dsf = db136.district_stat
|
||||
# client136 = pymongo.MongoClient('192.168.0.136',27017)
|
||||
# db136 = client136.fangjia
|
||||
|
||||
@timer
|
||||
|
||||
def region_district_list(ct, rl):
|
||||
# import pandas
|
||||
# client1 = pymongo.MongoClient('192.168.0.136',27017)
|
||||
@@ -1130,13 +1128,13 @@ def region_list(city):
|
||||
data = pandas.DataFrame(pos)
|
||||
return data['name']
|
||||
|
||||
@timer
|
||||
|
||||
def add_alias(ppd):
|
||||
if 'alias' not in ppd.columns:
|
||||
ppd['alias'] = '无'
|
||||
return ppd
|
||||
|
||||
@timer
|
||||
|
||||
def ghhh(kkg):
|
||||
kkg = kkg.fillna('无')
|
||||
a = list()
|
||||
@@ -1154,7 +1152,7 @@ pt = client1.fangjia_log.calc_command
|
||||
|
||||
|
||||
#################################################################
|
||||
@timer
|
||||
|
||||
def region_district_list_lk(ct, rl, lk):
|
||||
# import pandas
|
||||
# client1 = pymongo.MongoClient('192.168.0.136',27017)
|
||||
@@ -1257,7 +1255,7 @@ def make_up_price(ct, rl, lk, weekend):
|
||||
|
||||
# weekend=weekend00()
|
||||
|
||||
@fangjia.timer
|
||||
@timer
|
||||
def out_put_price(ct, rl, lk, weekend):
|
||||
lf = region_district_list_lk(ct, rl, lk)
|
||||
lf = add_alias(lf)
|
||||
|
||||
+1
-9
@@ -5,19 +5,11 @@ import sell_price.zhuge0118A as sellPrice
|
||||
|
||||
s = time.time()
|
||||
|
||||
#上海嘉定莱茵北郡
|
||||
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, weekend)
|
||||
|
||||
|
||||
e = time.time()
|
||||
print(e - s)
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user