优化成交挂牌价系数
This commit is contained in:
@@ -3,7 +3,6 @@ from datetime import datetime,date
|
|||||||
import pandas as pd
|
import pandas as pd
|
||||||
from dateutil.relativedelta import relativedelta
|
from dateutil.relativedelta import relativedelta
|
||||||
|
|
||||||
|
|
||||||
deal_price_conn = MAIN_MONGO_CLIENT.get_collection('fangjia', 'deal_price')
|
deal_price_conn = MAIN_MONGO_CLIENT.get_collection('fangjia', 'deal_price')
|
||||||
district_sell_stat_conn = MAIN_MONGO_CLIENT.get_collection('fangjia_stat', 'district_sell_stat')
|
district_sell_stat_conn = MAIN_MONGO_CLIENT.get_collection('fangjia_stat', 'district_sell_stat')
|
||||||
evaluate_ratio_conn = MAIN_MONGO_CLIENT.get_collection('business', 'evaluate_ratio')
|
evaluate_ratio_conn = MAIN_MONGO_CLIENT.get_collection('business', 'evaluate_ratio')
|
||||||
@@ -21,6 +20,7 @@ year = datetimeNow.year
|
|||||||
month = datetimeNow.month
|
month = datetimeNow.month
|
||||||
day = datetimeNow.day
|
day = datetimeNow.day
|
||||||
|
|
||||||
|
|
||||||
def sync():
|
def sync():
|
||||||
# 查询2年内成交价格
|
# 查询2年内成交价格
|
||||||
dear_price_r = deal_price_conn.find({
|
dear_price_r = deal_price_conn.find({
|
||||||
@@ -28,14 +28,15 @@ def sync():
|
|||||||
{
|
{
|
||||||
"$gte": datetime(ago_year, ago_month, ago_day, 0, 0),
|
"$gte": datetime(ago_year, ago_month, ago_day, 0, 0),
|
||||||
"$lt": datetime(year, month, day, 0, 0)
|
"$lt": datetime(year, month, day, 0, 0)
|
||||||
},
|
}
|
||||||
'area': {"$gt": 20},
|
}, {'city': 1, 'region': 1, 'district_name': 1, 'avg_price': 1, 'area': 1, 'trade_date': 1, 'match_id': 1,
|
||||||
'type': {'$ne': '车位'},
|
'type': 1}).batch_size(10000)
|
||||||
'match_id': {'$exists': 'true'},
|
|
||||||
'avg_price': {'$lte': 500000}
|
|
||||||
}, {'city': 1, 'region': 1, 'district_name': 1, 'avg_price': 1, 'area': 1, 'trade_date': 1, 'match_id': 1})
|
|
||||||
|
|
||||||
df1 = pd.DataFrame(list(dear_price_r))
|
df1 = pd.DataFrame(list(dear_price_r))
|
||||||
|
df1 = df1[df1.type != "车位"]
|
||||||
|
df1 = df1[df1.area > 20]
|
||||||
|
df1 = df1[df1.avg_price > 500000]
|
||||||
|
df1 = df1[~df1.match_id.isna()]
|
||||||
if df1.empty:
|
if df1.empty:
|
||||||
return
|
return
|
||||||
# 去重
|
# 去重
|
||||||
@@ -143,4 +144,5 @@ def sync():
|
|||||||
"$set": {"ratio": ratio, "m_date": m_date}}
|
"$set": {"ratio": ratio, "m_date": m_date}}
|
||||||
update_result = evaluate_ratio_conn.update_one(query, update, upsert=True)
|
update_result = evaluate_ratio_conn.update_one(query, update, upsert=True)
|
||||||
|
|
||||||
|
|
||||||
sync()
|
sync()
|
||||||
Reference in New Issue
Block a user