From 78e3670302ab467f043fccd076bd1986aab0605b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=BD=97=E5=B9=B2?= Date: Tue, 13 Mar 2018 11:11:22 +0800 Subject: [PATCH] =?UTF-8?q?=09=E4=BF=AE=E6=94=B9=EF=BC=9A=20=20=20=20=20Pr?= =?UTF-8?q?iceSystem/sell=5Fprice/zhuge0118A.py=20=09=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=EF=BC=9A=20=20=20=20=20PriceSystem/test.py?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- PriceSystem/sell_price/zhuge0118A.py | 46 ++++++++++++++++------------ PriceSystem/test.py | 46 +++++++++++++++++++--------- 2 files changed, 57 insertions(+), 35 deletions(-) diff --git a/PriceSystem/sell_price/zhuge0118A.py b/PriceSystem/sell_price/zhuge0118A.py index 53ca8d8..95ea013 100644 --- a/PriceSystem/sell_price/zhuge0118A.py +++ b/PriceSystem/sell_price/zhuge0118A.py @@ -1168,20 +1168,17 @@ def region_district_list_lk(ct, rl, lk): def last_sunday(weekend): + + #print('weekend_up',weekend) # import datetime - """ - today = datetime.datetime.now() - today=today+datetime.timedelta(days=-4) - - now_time=datetime.datetime(today.year, today.month, today.day, 0, 0, 0) - week_time = now_time.weekday() - """ - future_time = weekend - datetime.timedelta(days=7 - 1) - d1 = future_time.strftime('%Y%m%d') - weekend1 = datetime.datetime.strptime(d1, '%Y%m%d') - weekend = weekend1 + datetime.timedelta(hours=-8) - return weekend + last_sunday = weekend - datetime.timedelta(days=7) + #d1 = future_time.strftime('%Y%m%d') + #weekend1 = datetime.datetime.strptime(d1, '%Y%m%d') + #weekend = weekend1 + datetime.timedelta(hours=-8) + + #print('weekend',last_sunday) + return last_sunday # last_sunday=last_sunday(weekend) @@ -1253,30 +1250,37 @@ def make_up_price(ct, rl, lk, weekend): # weekend=weekend00() +def out_estate_type(estate_type): + if estate_type is not None and "别墅" in estate_type: + return '别墅','别墅' + else: + return '小区',"普通住宅" + + @timer def out_put_price(ct, rl, lk, weekend): lf = region_district_list_lk(ct, rl, lk) lf = add_alias(lf) + + #print('lf=',lf) p = ghhh(lf[['name', 'alias', 'estate_type2']])[0] - print('p=', p) + #print('p=', p) mm = commonprice(ct, rl, p) c_date = datetime.datetime.utcnow() m_date = datetime.datetime.utcnow() estate_type = lf['estate_type2'].iloc[0] - if estate_type is not None and "别墅" in estate_type: - estate_type = '别墅' - cmd_estate_type = '别墅' - else: - estate_type = '小区' - cmd_estate_type = "普通住宅" + + + estate_type,cmd_estate_type = out_estate_type(estate_type) + if type(mm[0]) != str: - print(ct, rl, lk, mm, '$' * 20) + #print(ct, rl, lk, mm, '$' * 20) # print(lf['estate_type2'].iloc[0],'*'*10) @@ -1298,6 +1302,8 @@ def out_put_price(ct, rl, lk, weekend): return 0 make_up = int(make_up()) + + #print('make_up',make_up,'*'*20) try: diff --git a/PriceSystem/test.py b/PriceSystem/test.py index 3cb97ed..923a59d 100644 --- a/PriceSystem/test.py +++ b/PriceSystem/test.py @@ -1,18 +1,34 @@ import datetime 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)