修改: PriceSystem/fix/price_fix.py

修改:     PriceSystem/sell_price/zhuge0118A.py
	修改:     PriceSystem/test.py
This commit is contained in:
罗干
2018-05-23 11:09:11 +08:00
parent f9a36721e9
commit 063db5f4e2
4 changed files with 75 additions and 59 deletions
+33 -25
View File
@@ -33,21 +33,15 @@ import time
# import yesterday
def front_step_time(day):
now = datetime.datetime.now()
def front_step_time(weekend,day):
#now = datetime.datetime.now()
now=weekend
front = now - datetime.timedelta(days=day)
d1 = front.strftime('%Y%m%d')
return int(d1)
# 提取房源的数据时间上限,如从20170301之后的数据
some_district_information_time = front_step_time(360)
# 提周边小区均价的数据时间上限,如从20170801之后的数据
zhoubian_xiaoqu_time = front_step_time(200)
# 第三方均价的数据时间上限,如从201703之后的数据
dsfjujia_time = front_step_time(200) // 100
############################################################
############################################################
@@ -67,7 +61,20 @@ value_type = pandas.Series([1, 2, 3, 4, 5, 6, 7],
# 1:指导价 2:自身样本 3:第三方 4:交易数据 5:周边楼盘, 6:推导
def commonprice(ct, rl, p):
def commonprice(ct, rl, p,weekend):
# 提取房源的数据时间上限,如从20170301之后的数据
some_district_information_time = front_step_time(weekend,360)
# 提周边小区均价的数据时间上限,如从20170801之后的数据
zhoubian_xiaoqu_time = front_step_time(weekend,200)
# 第三方均价的数据时间上限,如从201703之后的数据
dsfjujia_time = front_step_time(weekend,200) // 100
def add_block(ppd):
if 'block' not in ppd.columns:
ppd['block'] = '没有'
@@ -555,7 +562,7 @@ def commonprice(ct, rl, p):
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)
#print('dd=',dd,'dd'*20)
if dd.shape[0] >= factor:
# ####print('$'*50)
# dd1=neighbor(location['lng2'][0],location['lat2'][0],5)
@@ -576,19 +583,19 @@ def commonprice(ct, rl, p):
# svr_time=time.time()
other1 = svr(dd1, lk)
# ####print(time.time()-svr_time,'svr'*10)
# ####print('other1=',other1)
#print('other1=',other1)
return other1, dd1.shape[0]
else:
# t3=time.time()
dd2 = neighbor(location['lng2'].iloc[0], location['lat2'].iloc[0], 20, ct, rl, p)
# ####print(time.time()-t3,'t3'*10)
#####print('dd2.shape', dd2.shape[0], '@' * 60)
print('dd2.shape', dd2 ,'@' * 60)
if dd2.shape[0] >= factor:
#####print('$' * 50)
#svr_time = time.time()
other1 = svr(dd2, lk)
#####print(time.time() - svr_time, 'e' * 10)
# ####print('other1=',other1)
#print('other1=',other1)
return other1, dd2.shape[0]
else:
@@ -1219,9 +1226,9 @@ def commonprice(ct, rl, p):
return -2,float('%.2f' % credit['0.85']), value_type['第三方'], sample_size
def map_time_price(junjia,dglg,ppd3):
day_15=front_step_time(15)
day_30=front_step_time(30)
day_60=front_step_time(60)
day_15=front_step_time(weekend,15)
day_30=front_step_time(weekend,30)
day_60=front_step_time(weekend,60)
price_15= consider_time_ss1(junjia,dglg,ppd3,day_15)
price_30= consider_time_ss1(junjia,dglg,ppd3,day_30)
price_60= consider_time_ss1(junjia,dglg,ppd3,day_60)
@@ -1593,7 +1600,7 @@ def out_put_price(ct, rl, lk, weekend):
#####print('p=', p)
#t1=time.time()
mm = commonprice(ct, rl, p)
mm = commonprice(ct, rl, p,weekend)
#print('mmjisuantime=',time.time()-t1,'yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy')
#####print('mm=',mm)
c_date = datetime.datetime.utcnow()
@@ -1620,24 +1627,24 @@ def out_put_price(ct, rl, lk, weekend):
# ####print(time.time()-t1,'*'*20)
# ####print('last_sunday_price',last_sunday_price)
print('last_sunday_price=',last_sunday_price)
# ####print('mm[0]',mm[0])
def make_up():
def make_up(avg,last_sunday_price):
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
make_up = 10000 * (avg - last_sunday_price) / last_sunday_price
return make_up
else:
return 0
make_up = int(make_up())
#####print('make_up',make_up,'*'*20)
#####print('credic',mm[1])
def avg_compare(ct,rl,lk,mm):
avg=fix.price_fix.update(ct,rl,lk,int(mm[0]))
def avg_compare(ct,rl,lk,mm,weekend):
avg=fix.price_fix.update(ct,rl,lk,int(mm[0]),weekend)
#print('nihe=',avg)
#print('mm[0]',mm[0])
if avg>0:
@@ -1645,7 +1652,8 @@ def out_put_price(ct, rl, lk, weekend):
else:
return int(mm[0])
#s1=time.time()
avg=avg_compare(ct,rl,lk,mm)
avg=avg_compare(ct,rl,lk,mm,weekend)
make_up = int(make_up(avg,last_sunday_price))
#print('s1_time=',time.time()-s1)
#avg=mm[0]
print('mm=',mm)