移除无用包
This commit is contained in:
@@ -1,3 +1,7 @@
|
|||||||
/PriceSystem/config/__pycache__
|
/PriceSystem/config/__pycache__
|
||||||
/PriceSystem/PriceSystem/.idea
|
/PriceSystem/PriceSystem/.idea
|
||||||
|
*/__pycache__
|
||||||
.idea
|
.idea
|
||||||
|
/PriceSystem/fangjia/__pycache__
|
||||||
|
/PriceSystem/sell_price/__pycache__
|
||||||
|
/PriceSystem/zhuge/__pycache__
|
||||||
|
|||||||
@@ -2,9 +2,10 @@ import json
|
|||||||
import multiprocessing
|
import multiprocessing
|
||||||
import time
|
import time
|
||||||
import redis
|
import redis
|
||||||
|
import config
|
||||||
|
|
||||||
QUEUE = "calc_cmd"
|
QUEUE = "calc_cmd"
|
||||||
redis_pool = redis.ConnectionPool(host='192.168.0.144', port=6379, db=0)
|
redis_pool = redis.ConnectionPool(host=config.get_redis_host(), port=6379, db=0)
|
||||||
|
|
||||||
|
|
||||||
def monitor(pname):
|
def monitor(pname):
|
||||||
@@ -12,7 +13,7 @@ def monitor(pname):
|
|||||||
while True:
|
while True:
|
||||||
pre_counter = client.llen(QUEUE)
|
pre_counter = client.llen(QUEUE)
|
||||||
time.sleep(60)
|
time.sleep(60)
|
||||||
print(pname + "#####################################:".zfill(100) + str(
|
print(pname + "##################:".zfill(20) + str(
|
||||||
pre_counter - client.llen(QUEUE)) + "/min")
|
pre_counter - client.llen(QUEUE)) + "/min")
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -33,3 +33,7 @@ def get_log_mongodb_port():
|
|||||||
|
|
||||||
def get_timeout():
|
def get_timeout():
|
||||||
return 0.3
|
return 0.3
|
||||||
|
|
||||||
|
|
||||||
|
def get_seawater_host():
|
||||||
|
return "seawater.db.fangjia.com"
|
||||||
|
|||||||
@@ -66,7 +66,7 @@ def get_seawater_index_name(city, region):
|
|||||||
@timer
|
@timer
|
||||||
def findHouse(query, fields=None):
|
def findHouse(query, fields=None):
|
||||||
# s = time.time()
|
# s = time.time()
|
||||||
seawater105 = get_collection("fangjia", "seawater", "192.168.0.105", 27777)
|
seawater105 = get_collection("fangjia", "seawater", config.get_seawater_host(), 27777)
|
||||||
for err_count in range(0, 10):
|
for err_count in range(0, 10):
|
||||||
|
|
||||||
try:
|
try:
|
||||||
@@ -135,7 +135,7 @@ def find_house_from_elastic_search(city, region, alias, roots=None, pdate=None,
|
|||||||
@timer
|
@timer
|
||||||
def find_sample_pool(query, fields=None):
|
def find_sample_pool(query, fields=None):
|
||||||
# s = time.time()
|
# s = time.time()
|
||||||
seawater105 = get_collection("fangjia", "seawater", "192.168.0.105 ", 27777)
|
seawater105 = get_collection("fangjia", "seawater", config.get_seawater_host(), 27777)
|
||||||
for err_count in range(0, 10):
|
for err_count in range(0, 10):
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
|||||||
+4
-3
@@ -1,12 +1,13 @@
|
|||||||
import zhuge0118A
|
import zhuge0118A
|
||||||
import time
|
import time
|
||||||
|
import datetime
|
||||||
|
|
||||||
s = time.time()
|
s = time.time()
|
||||||
ct = '上海'
|
ct = '上海'
|
||||||
rl = '奉贤'
|
rl = '奉贤'
|
||||||
lk = '杨王村公寓'
|
lk = '杨王村公寓'
|
||||||
|
weekend = datetime.datetime.strptime("2018-03-11", "%Y-%m-%d")
|
||||||
|
|
||||||
|
zhuge0118A.out_put_price(ct, rl, lk, weekend)
|
||||||
zhuge0118A.out_put_price(ct, rl, lk)
|
|
||||||
zhuge0118A.out_put_price(ct, rl, lk)
|
|
||||||
e = time.time()
|
e = time.time()
|
||||||
print(e - s)
|
print(e - s)
|
||||||
|
|||||||
+18
-113
@@ -13,23 +13,18 @@ Created on Fri Sep 22 18:18:15 2017
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
import os
|
import os
|
||||||
print( os.getcwd())
|
|
||||||
import pymongo
|
|
||||||
import numpy as np
|
|
||||||
import pandas as pd
|
|
||||||
import random
|
import random
|
||||||
import collections
|
import collections
|
||||||
import pymongo
|
import pymongo
|
||||||
import sklearn.cluster
|
import sklearn.cluster
|
||||||
import pandas
|
import pandas
|
||||||
import numpy
|
import numpy
|
||||||
import sys, time
|
import time
|
||||||
import pp
|
|
||||||
import zhuge
|
|
||||||
import fangjia
|
import fangjia
|
||||||
import sklearn.svm
|
import sklearn.svm
|
||||||
import datetime
|
import datetime
|
||||||
|
|
||||||
|
|
||||||
# import yesterday
|
# import yesterday
|
||||||
|
|
||||||
def front_step_time(day):
|
def front_step_time(day):
|
||||||
@@ -39,14 +34,12 @@ def front_step_time(day):
|
|||||||
return int(d1)
|
return int(d1)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# 提取房源的数据时间上限,如从20170301之后的数据
|
# 提取房源的数据时间上限,如从20170301之后的数据
|
||||||
some_district_information_time = front_step_time(360)
|
some_district_information_time = front_step_time(360)
|
||||||
|
|
||||||
# 提周边小区均价的数据时间上限,如从20170801之后的数据
|
# 提周边小区均价的数据时间上限,如从20170801之后的数据
|
||||||
zhoubian_xiaoqu_time = front_step_time(200)
|
zhoubian_xiaoqu_time = front_step_time(200)
|
||||||
|
|
||||||
|
|
||||||
# 第三方均价的数据时间上限,如从201703之后的数据
|
# 第三方均价的数据时间上限,如从201703之后的数据
|
||||||
dsfjujia_time = front_step_time(430) // 100
|
dsfjujia_time = front_step_time(430) // 100
|
||||||
|
|
||||||
@@ -78,7 +71,6 @@ def weekend00():
|
|||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
||||||
# date="2018-02-04"
|
# date="2018-02-04"
|
||||||
############################################################
|
############################################################
|
||||||
############################################################
|
############################################################
|
||||||
@@ -88,13 +80,11 @@ credit=pandas.Series([0.9,0.8,0.7,0.6,0.5],index=['0.9','0.8','0.7','0.6','0.5']
|
|||||||
value_type = pandas.Series([1, 2, 3, 4, 5, 6, 7],
|
value_type = pandas.Series([1, 2, 3, 4, 5, 6, 7],
|
||||||
index=['指导价', '自身样本', '第三方', '交易数据', '周边楼盘', '推导', '优质样本'])
|
index=['指导价', '自身样本', '第三方', '交易数据', '周边楼盘', '推导', '优质样本'])
|
||||||
|
|
||||||
|
|
||||||
# 1:指导价 2:自身样本 3:第三方 4:交易数据 5:周边楼盘, 6:推导
|
# 1:指导价 2:自身样本 3:第三方 4:交易数据 5:周边楼盘, 6:推导
|
||||||
|
|
||||||
|
|
||||||
def commonprice(ct, rl, p):
|
def commonprice(ct, rl, p):
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def add_block(ppd):
|
def add_block(ppd):
|
||||||
if 'block' not in ppd.columns:
|
if 'block' not in ppd.columns:
|
||||||
ppd['block'] = '没有'
|
ppd['block'] = '没有'
|
||||||
@@ -105,10 +95,8 @@ def commonprice(ct,rl,p):
|
|||||||
ppd['room'] = 2
|
ppd['room'] = 2
|
||||||
return ppd
|
return ppd
|
||||||
|
|
||||||
|
|
||||||
def some_district_information(ct, rl, lk):
|
def some_district_information(ct, rl, lk):
|
||||||
|
|
||||||
|
|
||||||
query = {"city": ct, "cat": "sell", "region": rl,
|
query = {"city": ct, "cat": "sell", "region": rl,
|
||||||
"district_name": {"$in": lk},
|
"district_name": {"$in": lk},
|
||||||
"p_date": {"$gt": some_district_information_time}}
|
"p_date": {"$gt": some_district_information_time}}
|
||||||
@@ -148,9 +136,6 @@ def commonprice(ct,rl,p):
|
|||||||
else:
|
else:
|
||||||
return numpy.array([])
|
return numpy.array([])
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def take_location(ct, rl, p):
|
def take_location(ct, rl, p):
|
||||||
|
|
||||||
dirlt = p[0]
|
dirlt = p[0]
|
||||||
@@ -215,7 +200,6 @@ def commonprice(ct,rl,p):
|
|||||||
else:
|
else:
|
||||||
return 1
|
return 1
|
||||||
|
|
||||||
|
|
||||||
def zhuge(ur):
|
def zhuge(ur):
|
||||||
if 'zhuge' in ur:
|
if 'zhuge' in ur:
|
||||||
return 0
|
return 0
|
||||||
@@ -246,8 +230,6 @@ def commonprice(ct,rl,p):
|
|||||||
else:
|
else:
|
||||||
return 1
|
return 1
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def label(dd, f):
|
def label(dd, f):
|
||||||
aa = list()
|
aa = list()
|
||||||
|
|
||||||
@@ -258,8 +240,6 @@ def commonprice(ct,rl,p):
|
|||||||
aa.append(i)
|
aa.append(i)
|
||||||
return set(aa)
|
return set(aa)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def new_data(ds):
|
def new_data(ds):
|
||||||
bb = set(ds['name'])
|
bb = set(ds['name'])
|
||||||
bb1 = list(bb)
|
bb1 = list(bb)
|
||||||
@@ -270,7 +250,6 @@ def commonprice(ct,rl,p):
|
|||||||
x1[i] = a2.iloc[0]['fangjia_price']
|
x1[i] = a2.iloc[0]['fangjia_price']
|
||||||
return x1
|
return x1
|
||||||
|
|
||||||
|
|
||||||
def zhoubian_xiaoqu(ct, rl, dirst):
|
def zhoubian_xiaoqu(ct, rl, dirst):
|
||||||
|
|
||||||
# 提取周边小聚的均价,本方法不用房源,直接用上一批数据的价格来计算无房源小区
|
# 提取周边小聚的均价,本方法不用房源,直接用上一批数据的价格来计算无房源小区
|
||||||
@@ -312,7 +291,6 @@ def commonprice(ct,rl,p):
|
|||||||
|
|
||||||
return numpy.array([])
|
return numpy.array([])
|
||||||
|
|
||||||
|
|
||||||
def hh(ppp, df):
|
def hh(ppp, df):
|
||||||
ppp['price'] = None
|
ppp['price'] = None
|
||||||
aa = list(df.index)
|
aa = list(df.index)
|
||||||
@@ -326,8 +304,6 @@ def commonprice(ct,rl,p):
|
|||||||
# print('df[kk]',df[kk])
|
# print('df[kk]',df[kk])
|
||||||
return ppp
|
return ppp
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def neighbor(lng, lat, scale, ct, rl, p):
|
def neighbor(lng, lat, scale, ct, rl, p):
|
||||||
|
|
||||||
###################
|
###################
|
||||||
@@ -363,7 +339,6 @@ def commonprice(ct,rl,p):
|
|||||||
|
|
||||||
lr = le[['lng2', 'lat2']]
|
lr = le[['lng2', 'lat2']]
|
||||||
|
|
||||||
|
|
||||||
dirst1 = list(lr.index)
|
dirst1 = list(lr.index)
|
||||||
|
|
||||||
random.shuffle(dirst1)
|
random.shuffle(dirst1)
|
||||||
@@ -392,7 +367,6 @@ def commonprice(ct,rl,p):
|
|||||||
else:
|
else:
|
||||||
return numpy.array([])
|
return numpy.array([])
|
||||||
|
|
||||||
|
|
||||||
def svr(vv, lk):
|
def svr(vv, lk):
|
||||||
# 提取要计算小区的特征
|
# 提取要计算小区的特征
|
||||||
vk = vv[vv['district_name'] == lk]
|
vk = vv[vv['district_name'] == lk]
|
||||||
@@ -439,8 +413,6 @@ def commonprice(ct,rl,p):
|
|||||||
km = vv['price'].dropna()
|
km = vv['price'].dropna()
|
||||||
return int(k_means(km))
|
return int(k_means(km))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def no_source_price(ct, rl, location, p):
|
def no_source_price(ct, rl, location, p):
|
||||||
lk = p[0]
|
lk = p[0]
|
||||||
hg = location.shape[0]
|
hg = location.shape[0]
|
||||||
@@ -471,7 +443,6 @@ def commonprice(ct,rl,p):
|
|||||||
if dd1.shape[0] >= 20:
|
if dd1.shape[0] >= 20:
|
||||||
# print('$'*50)
|
# print('$'*50)
|
||||||
|
|
||||||
|
|
||||||
# svr_time=time.time()
|
# svr_time=time.time()
|
||||||
other1 = svr(dd1, lk)
|
other1 = svr(dd1, lk)
|
||||||
# print(time.time()-svr_time,'svr'*10)
|
# print(time.time()-svr_time,'svr'*10)
|
||||||
@@ -502,7 +473,6 @@ def commonprice(ct,rl,p):
|
|||||||
|
|
||||||
return '没有周围小区数据', 0
|
return '没有周围小区数据', 0
|
||||||
|
|
||||||
|
|
||||||
def region_district_list(ct, rl):
|
def region_district_list(ct, rl):
|
||||||
# import pandas
|
# import pandas
|
||||||
# client1 = pymongo.MongoClient('192.168.0.136',27017)
|
# client1 = pymongo.MongoClient('192.168.0.136',27017)
|
||||||
@@ -518,9 +488,6 @@ def commonprice(ct,rl,p):
|
|||||||
lf = fangjia.find_seaweed(query1, fields1)
|
lf = fangjia.find_seaweed(query1, fields1)
|
||||||
return lf
|
return lf
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def k_means(pp1):
|
def k_means(pp1):
|
||||||
from sklearn.cluster import KMeans
|
from sklearn.cluster import KMeans
|
||||||
pv = list(pp1)
|
pv = list(pp1)
|
||||||
@@ -541,7 +508,6 @@ def commonprice(ct,rl,p):
|
|||||||
else:
|
else:
|
||||||
return int(pp1.mean())
|
return int(pp1.mean())
|
||||||
|
|
||||||
|
|
||||||
def region_district_list_name(ct, rl, lkk):
|
def region_district_list_name(ct, rl, lkk):
|
||||||
# import pandas
|
# import pandas
|
||||||
# client1 = pymongo.MongoClient('192.168.0.136',27017)
|
# client1 = pymongo.MongoClient('192.168.0.136',27017)
|
||||||
@@ -554,12 +520,10 @@ def commonprice(ct,rl,p):
|
|||||||
|
|
||||||
# lct= list( seaweed136.find(query1, fields1))
|
# lct= list( seaweed136.find(query1, fields1))
|
||||||
|
|
||||||
|
|
||||||
# lf=pandas.DataFrame(lct)
|
# lf=pandas.DataFrame(lct)
|
||||||
lf = fangjia.find_seaweed(query1, fields1)
|
lf = fangjia.find_seaweed(query1, fields1)
|
||||||
return lf
|
return lf
|
||||||
|
|
||||||
|
|
||||||
def strip_villa(ct, rl, p):
|
def strip_villa(ct, rl, p):
|
||||||
lw = p[0]
|
lw = p[0]
|
||||||
# estype=p[2]
|
# estype=p[2]
|
||||||
@@ -617,7 +581,6 @@ def commonprice(ct,rl,p):
|
|||||||
else:
|
else:
|
||||||
return cc1
|
return cc1
|
||||||
|
|
||||||
|
|
||||||
def consider_villa(ct, rl, p):
|
def consider_villa(ct, rl, p):
|
||||||
|
|
||||||
# print('villa p=',p)
|
# print('villa p=',p)
|
||||||
@@ -648,7 +611,6 @@ def commonprice(ct,rl,p):
|
|||||||
else:
|
else:
|
||||||
return df
|
return df
|
||||||
|
|
||||||
|
|
||||||
def fetch_villa_index(dd):
|
def fetch_villa_index(dd):
|
||||||
|
|
||||||
# dd=dd.dropna()
|
# dd=dd.dropna()
|
||||||
@@ -656,7 +618,6 @@ def commonprice(ct,rl,p):
|
|||||||
|
|
||||||
# print(dd)
|
# print(dd)
|
||||||
|
|
||||||
|
|
||||||
villa_label = ["独栋", "联排", "叠加", "双拼",
|
villa_label = ["独栋", "联排", "叠加", "双拼",
|
||||||
"花园面积", "泳池", "别墅", "带花园"]
|
"花园面积", "泳池", "别墅", "带花园"]
|
||||||
bb = list()
|
bb = list()
|
||||||
@@ -674,11 +635,6 @@ def commonprice(ct,rl,p):
|
|||||||
|
|
||||||
return villa
|
return villa
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def dsfjujia(ct, rl, lk):
|
def dsfjujia(ct, rl, lk):
|
||||||
|
|
||||||
query = {"city": ct, "region": rl,
|
query = {"city": ct, "region": rl,
|
||||||
@@ -709,9 +665,6 @@ def commonprice(ct,rl,p):
|
|||||||
# print('采用抓取的第三方均价')
|
# print('采用抓取的第三方均价')
|
||||||
return ser
|
return ser
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def sfjj(ll_zz, aa_zz, dddf):
|
def sfjj(ll_zz, aa_zz, dddf):
|
||||||
|
|
||||||
dxx = pandas.Series()
|
dxx = pandas.Series()
|
||||||
@@ -719,6 +672,7 @@ def commonprice(ct,rl,p):
|
|||||||
if i in aa_zz:
|
if i in aa_zz:
|
||||||
dxx[i] = dddf[i]
|
dxx[i] = dddf[i]
|
||||||
return int(dxx.mean())
|
return int(dxx.mean())
|
||||||
|
|
||||||
"""
|
"""
|
||||||
tt=timm//100
|
tt=timm//100
|
||||||
|
|
||||||
@@ -763,11 +717,13 @@ def commonprice(ct,rl,p):
|
|||||||
for i in junjia_lzf.index:
|
for i in junjia_lzf.index:
|
||||||
# print(junjia_lzf)
|
# print(junjia_lzf)
|
||||||
someprice = junjia_lzf[i]
|
someprice = junjia_lzf[i]
|
||||||
|
|
||||||
def compare15(b):
|
def compare15(b):
|
||||||
if 100 * abs(someprice - b) / b < 16:
|
if 100 * abs(someprice - b) / b < 16:
|
||||||
return 1
|
return 1
|
||||||
else:
|
else:
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
countmap = list(map(compare15, junjia_anst))
|
countmap = list(map(compare15, junjia_anst))
|
||||||
# print('countmap=',countmap)
|
# print('countmap=',countmap)
|
||||||
countmap1 = pandas.Series(countmap)
|
countmap1 = pandas.Series(countmap)
|
||||||
@@ -787,7 +743,6 @@ def commonprice(ct,rl,p):
|
|||||||
# print('junjia_lzf=',junjia_lzf)
|
# print('junjia_lzf=',junjia_lzf)
|
||||||
# print('junjia_anst=',junjia_anst)
|
# print('junjia_anst=',junjia_anst)
|
||||||
|
|
||||||
|
|
||||||
def mid_out_1(junjia_lzf):
|
def mid_out_1(junjia_lzf):
|
||||||
|
|
||||||
if len(junjia_lzf) > 1:
|
if len(junjia_lzf) > 1:
|
||||||
@@ -804,7 +759,6 @@ def commonprice(ct,rl,p):
|
|||||||
else:
|
else:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
|
||||||
def mid_out_2(junjia_lzf, junjia_anst):
|
def mid_out_2(junjia_lzf, junjia_anst):
|
||||||
|
|
||||||
if len(junjia_lzf) > 0 and len(junjia_anst) > 0:
|
if len(junjia_lzf) > 0 and len(junjia_anst) > 0:
|
||||||
@@ -820,6 +774,7 @@ def commonprice(ct,rl,p):
|
|||||||
return None
|
return None
|
||||||
else:
|
else:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
a11 = mid_out_1(junjia_lzf)
|
a11 = mid_out_1(junjia_lzf)
|
||||||
a22 = mid_out_2(junjia_lzf, junjia_anst)
|
a22 = mid_out_2(junjia_lzf, junjia_anst)
|
||||||
a33 = mid_out_1(junjia_anst)
|
a33 = mid_out_1(junjia_anst)
|
||||||
@@ -830,21 +785,21 @@ def commonprice(ct,rl,p):
|
|||||||
else:
|
else:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
|
||||||
def devide_group(al, bl, junjia):
|
def devide_group(al, bl, junjia):
|
||||||
|
|
||||||
alls = set(junjia.index)
|
alls = set(junjia.index)
|
||||||
|
|
||||||
def set_div(ds, alls):
|
def set_div(ds, alls):
|
||||||
if len(set(ds) & alls) > 0:
|
if len(set(ds) & alls) > 0:
|
||||||
return junjia[ds].dropna()
|
return junjia[ds].dropna()
|
||||||
else:
|
else:
|
||||||
return pandas.Series()
|
return pandas.Series()
|
||||||
|
|
||||||
lzf = set_div(al, alls)
|
lzf = set_div(al, alls)
|
||||||
anst = set_div(bl, alls)
|
anst = set_div(bl, alls)
|
||||||
|
|
||||||
return lzf, anst
|
return lzf, anst
|
||||||
|
|
||||||
|
|
||||||
def dglg_out1(junjia, neighb):
|
def dglg_out1(junjia, neighb):
|
||||||
|
|
||||||
"""
|
"""
|
||||||
@@ -855,7 +810,6 @@ def commonprice(ct,rl,p):
|
|||||||
]
|
]
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
||||||
al = [
|
al = [
|
||||||
'lianjia_esf_price',
|
'lianjia_esf_price',
|
||||||
'zhugezhaofang_esf_price',
|
'zhugezhaofang_esf_price',
|
||||||
@@ -891,7 +845,6 @@ def commonprice(ct,rl,p):
|
|||||||
dg22 = middle_operate(junjia_lzf, junjia_anst)
|
dg22 = middle_operate(junjia_lzf, junjia_anst)
|
||||||
return dg22
|
return dg22
|
||||||
|
|
||||||
|
|
||||||
lk = p[0]
|
lk = p[0]
|
||||||
location = take_location(ct, rl, p)
|
location = take_location(ct, rl, p)
|
||||||
|
|
||||||
@@ -937,8 +890,6 @@ def commonprice(ct,rl,p):
|
|||||||
|
|
||||||
# ppd2=ppd1
|
# ppd2=ppd1
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# if type(neighb) is not str:
|
# if type(neighb) is not str:
|
||||||
|
|
||||||
if ppd1.shape[0] > 0:
|
if ppd1.shape[0] > 0:
|
||||||
@@ -951,6 +902,7 @@ def commonprice(ct,rl,p):
|
|||||||
return ppd2
|
return ppd2
|
||||||
|
|
||||||
# ppd3=ppd2[ppd2['total_price']>0.6*neighb]
|
# ppd3=ppd2[ppd2['total_price']>0.6*neighb]
|
||||||
|
|
||||||
######################################
|
######################################
|
||||||
ppd3 = guolv_data(ppd1, neighb[0])
|
ppd3 = guolv_data(ppd1, neighb[0])
|
||||||
|
|
||||||
@@ -975,7 +927,6 @@ def commonprice(ct,rl,p):
|
|||||||
length = len(l_and_z)
|
length = len(l_and_z)
|
||||||
length1 = len(allf)
|
length1 = len(allf)
|
||||||
|
|
||||||
|
|
||||||
if dglg != None:
|
if dglg != None:
|
||||||
|
|
||||||
# print('junjia.shape',len(junjia))
|
# print('junjia.shape',len(junjia))
|
||||||
@@ -1017,7 +968,6 @@ def commonprice(ct,rl,p):
|
|||||||
|
|
||||||
if ddd11.shape[0] > 2:
|
if ddd11.shape[0] > 2:
|
||||||
|
|
||||||
|
|
||||||
s = zhuge_consist.url_lable(ddd11)
|
s = zhuge_consist.url_lable(ddd11)
|
||||||
s1 = zhuge_consist.drop_rubbish(s)
|
s1 = zhuge_consist.drop_rubbish(s)
|
||||||
# print('s1=',s1)
|
# print('s1=',s1)
|
||||||
@@ -1032,7 +982,6 @@ def commonprice(ct,rl,p):
|
|||||||
def compelex(ddd11, s, neighb, junjia):
|
def compelex(ddd11, s, neighb, junjia):
|
||||||
cc1 = ddd11['avg'].dropna()
|
cc1 = ddd11['avg'].dropna()
|
||||||
|
|
||||||
|
|
||||||
kmzhuge = k_means(cc1)
|
kmzhuge = k_means(cc1)
|
||||||
|
|
||||||
junjia['zhuge_logic'] = s
|
junjia['zhuge_logic'] = s
|
||||||
@@ -1040,7 +989,6 @@ def commonprice(ct,rl,p):
|
|||||||
junjia['kmzg'] = kmzhuge
|
junjia['kmzg'] = kmzhuge
|
||||||
|
|
||||||
if type(neighb) != str and (neighb) != None:
|
if type(neighb) != str and (neighb) != None:
|
||||||
|
|
||||||
junjia['neighb'] = neighb
|
junjia['neighb'] = neighb
|
||||||
# print('junjia',junjia)
|
# print('junjia',junjia)
|
||||||
|
|
||||||
@@ -1054,11 +1002,12 @@ def commonprice(ct,rl,p):
|
|||||||
cc2 = cc1.sort_values(by='count', ascending=False)
|
cc2 = cc1.sort_values(by='count', ascending=False)
|
||||||
# print(bb2)
|
# print(bb2)
|
||||||
sample_size = ddd11.shape[0]
|
sample_size = ddd11.shape[0]
|
||||||
return cc2.iloc[0]['price']*1.0,float('%.2f' % credit['0.7']),value_type['第三方'],sample_size
|
return cc2.iloc[0]['price'] * 1.0, float('%.2f' % credit['0.7']), value_type[
|
||||||
|
'第三方'], sample_size
|
||||||
else:
|
else:
|
||||||
sample_size = ddd11.shape[0]
|
sample_size = ddd11.shape[0]
|
||||||
return junjia['kmzg']*1.0,float('%.2f' % credit['0.6']),value_type['自身样本'],sample_size
|
return junjia['kmzg'] * 1.0, float('%.2f' % credit['0.6']), value_type[
|
||||||
|
'自身样本'], sample_size
|
||||||
|
|
||||||
junjia_km = compelex(ddd11, s, neighb[0], junjia)
|
junjia_km = compelex(ddd11, s, neighb[0], junjia)
|
||||||
|
|
||||||
@@ -1105,8 +1054,6 @@ def commonprice(ct,rl,p):
|
|||||||
return neighb[0], float('%.2f' % credit['0.5']), value_type['周边楼盘'], neighb[1]
|
return neighb[0], float('%.2f' % credit['0.5']), value_type['周边楼盘'], neighb[1]
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
client65 = pymongo.MongoClient('192.168.0.105', 27777)
|
client65 = pymongo.MongoClient('192.168.0.105', 27777)
|
||||||
db65 = client65.fangjia
|
db65 = client65.fangjia
|
||||||
seawater65 = db65.seawater
|
seawater65 = db65.seawater
|
||||||
@@ -1116,16 +1063,13 @@ db136 = client136.fangjia
|
|||||||
dsf136 = db136.average_statistics
|
dsf136 = db136.average_statistics
|
||||||
seaweed136 = db136.seaweed
|
seaweed136 = db136.seaweed
|
||||||
|
|
||||||
|
|
||||||
dsf = db136.district_stat
|
dsf = db136.district_stat
|
||||||
|
|
||||||
|
|
||||||
# client136 = pymongo.MongoClient('192.168.0.136',27017)
|
# client136 = pymongo.MongoClient('192.168.0.136',27017)
|
||||||
# db136 = client136.fangjia
|
# db136 = client136.fangjia
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def region_district_list(ct, rl):
|
def region_district_list(ct, rl):
|
||||||
# import pandas
|
# import pandas
|
||||||
# client1 = pymongo.MongoClient('192.168.0.136',27017)
|
# client1 = pymongo.MongoClient('192.168.0.136',27017)
|
||||||
@@ -1141,18 +1085,16 @@ def region_district_list(ct,rl):
|
|||||||
lf = fangjia.find_seaweed(query1, fields1)
|
lf = fangjia.find_seaweed(query1, fields1)
|
||||||
return lf
|
return lf
|
||||||
|
|
||||||
|
|
||||||
def city_list():
|
def city_list():
|
||||||
# client = pymongo.MongoClient('192.168.0.136',27017) #'192.168.0.65',27777
|
# client = pymongo.MongoClient('192.168.0.136',27017) #'192.168.0.65',27777
|
||||||
# db = client.fangjia
|
# db = client.fangjia
|
||||||
city = db136.server_area
|
city = db136.server_area
|
||||||
# seawater.find_one()
|
# seawater.find_one()
|
||||||
|
|
||||||
|
|
||||||
pos = city.find({"display": {"$ne": "全国"}},
|
pos = city.find({"display": {"$ne": "全国"}},
|
||||||
{"display": 1, "city_grade": 1, "_id": 1}).sort([("city_grade", 1), ("_id", 1)])
|
{"display": 1, "city_grade": 1, "_id": 1}).sort([("city_grade", 1), ("_id", 1)])
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
data = pandas.DataFrame(list(pos))
|
data = pandas.DataFrame(list(pos))
|
||||||
# print(data)
|
# print(data)
|
||||||
return data['display']
|
return data['display']
|
||||||
@@ -1161,7 +1103,6 @@ def city_list():
|
|||||||
# print(some_district_information())
|
# print(some_district_information())
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def region_list(city):
|
def region_list(city):
|
||||||
# client = pymongo.MongoClient('192.168.0.136',27017)
|
# client = pymongo.MongoClient('192.168.0.136',27017)
|
||||||
# db = client.fangjia
|
# db = client.fangjia
|
||||||
@@ -1171,22 +1112,16 @@ def region_list(city):
|
|||||||
fields1 = {"name": 1}
|
fields1 = {"name": 1}
|
||||||
pos = list(region.find(query, fields1))
|
pos = list(region.find(query, fields1))
|
||||||
|
|
||||||
|
|
||||||
data = pandas.DataFrame(pos)
|
data = pandas.DataFrame(pos)
|
||||||
return data['name']
|
return data['name']
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def add_alias(ppd):
|
def add_alias(ppd):
|
||||||
if 'alias' not in ppd.columns:
|
if 'alias' not in ppd.columns:
|
||||||
ppd['alias'] = '无'
|
ppd['alias'] = '无'
|
||||||
return ppd
|
return ppd
|
||||||
|
|
||||||
|
|
||||||
def ghhh(kkg):
|
def ghhh(kkg):
|
||||||
kkg = kkg.fillna('无')
|
kkg = kkg.fillna('无')
|
||||||
a = list()
|
a = list()
|
||||||
@@ -1196,8 +1131,6 @@ def ghhh(kkg):
|
|||||||
return a
|
return a
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
client1 = pymongo.MongoClient('192.168.10.182', 27017)
|
client1 = pymongo.MongoClient('192.168.10.182', 27017)
|
||||||
db1 = client1.fangjia
|
db1 = client1.fangjia
|
||||||
stat = db1.distrit_stat
|
stat = db1.distrit_stat
|
||||||
@@ -1223,9 +1156,6 @@ def region_district_list_lk(ct,rl,lk):
|
|||||||
return lf
|
return lf
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def last_sunday(weekend):
|
def last_sunday(weekend):
|
||||||
# import datetime
|
# import datetime
|
||||||
"""
|
"""
|
||||||
@@ -1243,30 +1173,21 @@ def last_sunday(weekend):
|
|||||||
return weekend
|
return weekend
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# last_sunday=last_sunday(weekend)
|
# last_sunday=last_sunday(weekend)
|
||||||
|
|
||||||
def make_up_price(ct, rl, lk, weekend):
|
def make_up_price(ct, rl, lk, weekend):
|
||||||
|
|
||||||
|
|
||||||
# last_sunday=last_sunday(weekend)
|
# last_sunday=last_sunday(weekend)
|
||||||
# save_lg=client136.fangjia.district_stat
|
# save_lg=client136.fangjia.district_stat
|
||||||
if lk != None:
|
if lk != None:
|
||||||
|
|
||||||
# cc=last_sunday
|
# cc=last_sunday
|
||||||
|
|
||||||
|
|
||||||
ly = last_sunday(weekend)
|
ly = last_sunday(weekend)
|
||||||
# stat= fangjia.get_collection("fangjia_stat","test_lg5", '192.168.0.136',27017)
|
# stat= fangjia.get_collection("fangjia_stat","test_lg5", '192.168.0.136',27017)
|
||||||
stat = dsf
|
stat = dsf
|
||||||
query = {"city": ct, "region": rl, "district_name": lk, 'weekend': ly
|
query = {"city": ct, "region": rl, "district_name": lk, 'weekend': ly
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
pos1 = list(stat.find(query).limit(30))
|
pos1 = list(stat.find(query).limit(30))
|
||||||
|
|
||||||
pos = pandas.DataFrame(pos1)
|
pos = pandas.DataFrame(pos1)
|
||||||
@@ -1283,8 +1204,6 @@ def make_up_price(ct,rl,lk,weekend):
|
|||||||
pp1 = pos['avg_price'].iloc[0]
|
pp1 = pos['avg_price'].iloc[0]
|
||||||
if type(pp1) != None and type(pp1) != str:
|
if type(pp1) != None and type(pp1) != str:
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return int(pp1)
|
return int(pp1)
|
||||||
else:
|
else:
|
||||||
return None
|
return None
|
||||||
@@ -1298,7 +1217,6 @@ def make_up_price(ct,rl,lk,weekend):
|
|||||||
query = {"city": ct, "region": rl, "district_name": lk, 'weekend': last_sunday
|
query = {"city": ct, "region": rl, "district_name": lk, 'weekend': last_sunday
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
pos1 = list(stat.find(query).limit(30))
|
pos1 = list(stat.find(query).limit(30))
|
||||||
|
|
||||||
pos = pandas.DataFrame(pos1)
|
pos = pandas.DataFrame(pos1)
|
||||||
@@ -1315,8 +1233,6 @@ def make_up_price(ct,rl,lk,weekend):
|
|||||||
pp1 = pos['avg_price'].iloc[0]
|
pp1 = pos['avg_price'].iloc[0]
|
||||||
if type(pp1) != None and type(pp1) != str:
|
if type(pp1) != None and type(pp1) != str:
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return int(pp1)
|
return int(pp1)
|
||||||
else:
|
else:
|
||||||
return None
|
return None
|
||||||
@@ -1324,8 +1240,6 @@ def make_up_price(ct,rl,lk,weekend):
|
|||||||
return None
|
return None
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# weekend=weekend00()
|
# weekend=weekend00()
|
||||||
|
|
||||||
@fangjia.timer
|
@fangjia.timer
|
||||||
@@ -1346,11 +1260,10 @@ def out_put_price(ct,rl,lk,weekend):
|
|||||||
# print(lf['estate_type2'].iloc[0],'*'*10)
|
# print(lf['estate_type2'].iloc[0],'*'*10)
|
||||||
estate_type = lf['estate_type2'].iloc[0]
|
estate_type = lf['estate_type2'].iloc[0]
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# last_sunday=last_sunday()
|
# last_sunday=last_sunday()
|
||||||
# t1=time.time()
|
# t1=time.time()
|
||||||
last_sunday_price = make_up_price(ct, rl, lk, weekend)
|
last_sunday_price = make_up_price(ct, rl, lk, weekend)
|
||||||
|
|
||||||
# print(time.time()-t1,'*'*20)
|
# print(time.time()-t1,'*'*20)
|
||||||
|
|
||||||
# print('last_sunday_price',last_sunday_price)
|
# print('last_sunday_price',last_sunday_price)
|
||||||
@@ -1366,7 +1279,6 @@ def out_put_price(ct,rl,lk,weekend):
|
|||||||
|
|
||||||
make_up = int(make_up())
|
make_up = int(make_up())
|
||||||
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
|
||||||
stat.replace_one(
|
stat.replace_one(
|
||||||
@@ -1380,13 +1292,10 @@ def out_put_price(ct,rl,lk,weekend):
|
|||||||
'estate_type': estate_type}, True
|
'estate_type': estate_type}, True
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
pt.replace_one(
|
pt.replace_one(
|
||||||
|
|
||||||
{"city": ct, "region": rl, "district_name": p[0], "weekend": weekend},
|
{"city": ct, "region": rl, "district_name": p[0], "weekend": weekend},
|
||||||
|
|
||||||
|
|
||||||
{"city": ct, "region": rl, "district_name": p[0], "c_date": c_date, 'status': int(0),
|
{"city": ct, "region": rl, "district_name": p[0], "c_date": c_date, 'status': int(0),
|
||||||
'remark': 'week', 'category': 'sell', 'weekend': weekend, 'priority': int(0),
|
'remark': 'week', 'category': 'sell', 'weekend': weekend, 'priority': int(0),
|
||||||
'problem': None,
|
'problem': None,
|
||||||
@@ -1412,12 +1321,8 @@ def out_put_price(ct,rl,lk,weekend):
|
|||||||
|
|
||||||
{"city": ct, "region": rl, "district_name": p[0], "weekend": weekend},
|
{"city": ct, "region": rl, "district_name": p[0], "weekend": weekend},
|
||||||
|
|
||||||
|
|
||||||
{"city": ct, "region": rl, "district_name": p[0], "c_date": c_date, 'status': int(1),
|
{"city": ct, "region": rl, "district_name": p[0], "c_date": c_date, 'status': int(1),
|
||||||
'remark': 'week', 'category': 'sell', 'weekend': weekend, 'priority': int(0),
|
'remark': 'week', 'category': 'sell', 'weekend': weekend, 'priority': int(0),
|
||||||
'problem': mm[0],
|
'problem': mm[0],
|
||||||
}, True
|
}, True
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Reference in New Issue
Block a user