修改: PriceSystem/sell_price/zhuge0118A.py

修改:     PriceSystem/test.py
This commit is contained in:
罗干
2018-03-13 11:11:22 +08:00
parent 27225947d2
commit 78e3670302
2 changed files with 57 additions and 35 deletions
+26 -20
View File
@@ -1168,20 +1168,17 @@ def region_district_list_lk(ct, rl, lk):
def last_sunday(weekend): def last_sunday(weekend):
#print('weekend_up',weekend)
# import datetime # import datetime
"""
today = datetime.datetime.now()
today=today+datetime.timedelta(days=-4) last_sunday = weekend - datetime.timedelta(days=7)
#d1 = future_time.strftime('%Y%m%d')
now_time=datetime.datetime(today.year, today.month, today.day, 0, 0, 0) #weekend1 = datetime.datetime.strptime(d1, '%Y%m%d')
week_time = now_time.weekday() #weekend = weekend1 + datetime.timedelta(hours=-8)
"""
future_time = weekend - datetime.timedelta(days=7 - 1) #print('weekend',last_sunday)
d1 = future_time.strftime('%Y%m%d') return last_sunday
weekend1 = datetime.datetime.strptime(d1, '%Y%m%d')
weekend = weekend1 + datetime.timedelta(hours=-8)
return weekend
# last_sunday=last_sunday(weekend) # last_sunday=last_sunday(weekend)
@@ -1253,30 +1250,37 @@ def make_up_price(ct, rl, lk, weekend):
# weekend=weekend00() # weekend=weekend00()
def out_estate_type(estate_type):
if estate_type is not None and "别墅" in estate_type:
return '别墅','别墅'
else:
return '小区',"普通住宅"
@timer @timer
def out_put_price(ct, rl, lk, weekend): def out_put_price(ct, rl, lk, weekend):
lf = region_district_list_lk(ct, rl, lk) lf = region_district_list_lk(ct, rl, lk)
lf = add_alias(lf) lf = add_alias(lf)
#print('lf=',lf)
p = ghhh(lf[['name', 'alias', 'estate_type2']])[0] p = ghhh(lf[['name', 'alias', 'estate_type2']])[0]
print('p=', p) #print('p=', p)
mm = commonprice(ct, rl, p) mm = commonprice(ct, rl, p)
c_date = datetime.datetime.utcnow() c_date = datetime.datetime.utcnow()
m_date = datetime.datetime.utcnow() m_date = datetime.datetime.utcnow()
estate_type = lf['estate_type2'].iloc[0] estate_type = lf['estate_type2'].iloc[0]
if estate_type is not None and "别墅" in estate_type:
estate_type = '别墅'
cmd_estate_type = '别墅' estate_type,cmd_estate_type = out_estate_type(estate_type)
else:
estate_type = '小区'
cmd_estate_type = "普通住宅"
if type(mm[0]) != str: if type(mm[0]) != str:
print(ct, rl, lk, mm, '$' * 20) #print(ct, rl, lk, mm, '$' * 20)
# print(lf['estate_type2'].iloc[0],'*'*10) # print(lf['estate_type2'].iloc[0],'*'*10)
@@ -1298,6 +1302,8 @@ def out_put_price(ct, rl, lk, weekend):
return 0 return 0
make_up = int(make_up()) make_up = int(make_up())
#print('make_up',make_up,'*'*20)
try: try:
+31 -15
View File
@@ -1,18 +1,34 @@
import datetime import datetime
import fangjia import fangjia
fangjia.send_dingding_msg("测试") #fangjia.send_dingding_msg("测试")
import time
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, fangjia.get_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)
'''
# import time
#
# import sell_price.zhuge0118A as sellPrice
#
# s = time.time()
#
# ct = '上海'
# rl = '杨浦'
# lk = '邯郸路60弄小区'
# 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)