Merge remote-tracking branch 'origin/master'
This commit is contained in:
@@ -47,11 +47,13 @@ def build_doc(item):
|
|||||||
|
|
||||||
estate_charge = commutils.format_property_fee(item['estate_charge'])
|
estate_charge = commutils.format_property_fee(item['estate_charge'])
|
||||||
if pd.notna(estate_charge):
|
if pd.notna(estate_charge):
|
||||||
doc_dict['estate_charge'] = float(estate_charge)
|
# 剔除过大物业费导致ES报错
|
||||||
# 表示该物业费已经从库中补充
|
if float(estate_charge) <= 1000:
|
||||||
doc_dict['estate_charge_flag'] = 0
|
doc_dict['estate_charge'] = float(estate_charge)
|
||||||
# 先打10分,对于其他的流程在修改分数
|
# 表示该物业费已经从库中补充
|
||||||
doc_dict['credit_detail'] = {'estate_charge_score': 10}
|
doc_dict['estate_charge_flag'] = 0
|
||||||
|
# 先打10分,对于其他的流程在修改分数
|
||||||
|
doc_dict['credit_detail'] = {'estate_charge_score': 10}
|
||||||
|
|
||||||
finish_building_date = commutils.format_finish_building_date(item['finish_building_date'])
|
finish_building_date = commutils.format_finish_building_date(item['finish_building_date'])
|
||||||
if pd.notna(finish_building_date):
|
if pd.notna(finish_building_date):
|
||||||
|
|||||||
@@ -1,13 +1,18 @@
|
|||||||
"""
|
"""
|
||||||
价格异常检测脚本
|
价格异常检测脚本
|
||||||
"""
|
"""
|
||||||
from goojia_utils import dateutils, pgsql
|
from goojia_utils import dateutils, pgsql, MAIN_MONGO_CLIENT, data_utils
|
||||||
import pandas as pd
|
import pandas as pd
|
||||||
import logging
|
import logging
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
import requests
|
import requests
|
||||||
|
|
||||||
|
seaweed_conn = MAIN_MONGO_CLIENT.get_collection('fangjia', 'seaweed')
|
||||||
|
# 获取独家小区
|
||||||
|
exclusive_seaweed_df = pd.DataFrame(list(seaweed_conn.find({'cat': 'district', 'status': 0, 'mark_map.exclusive': '是'}, {'city': 1, 'region': 1, 'name': 1, 'mark_map.exclusive': 1}).batch_size(100000)))
|
||||||
|
exclusive_seaweed_df = data_utils.flatten_json(exclusive_seaweed_df, 'mark_map')
|
||||||
|
exclusive_seaweed_df = exclusive_seaweed_df.rename(columns={'name': 'commname', 'exclusive': '独家小区'})
|
||||||
|
|
||||||
def simple_calc(result_df):
|
def simple_calc(result_df):
|
||||||
"""
|
"""
|
||||||
@@ -111,7 +116,7 @@ for key in six_map:
|
|||||||
if abs(six_price - five_price) * 100 / five_price > 10:
|
if abs(six_price - five_price) * 100 / five_price > 10:
|
||||||
actions.append({'city': info[0], 'region': info[1], 'commid': info[2], 'commname': info[3],
|
actions.append({'city': info[0], 'region': info[1], 'commid': info[2], 'commname': info[3],
|
||||||
'five_price': five_price,'five_calc_type': five_map[key].split("|")[1],
|
'five_price': five_price,'five_calc_type': five_map[key].split("|")[1],
|
||||||
'six_price': six_price,'six_calc_type': six_map[key].split("|")[1],
|
'six_price': six_price,'six_calc_type': six_map[key].split("|")[1], '差异值': abs(six_price - five_price) * 100 / five_price,
|
||||||
'涨跌幅': (six_price - five_price) * 100 / five_price, 'confidence': six_map[key].split("|")[2]})
|
'涨跌幅': (six_price - five_price) * 100 / five_price, 'confidence': six_map[key].split("|")[2]})
|
||||||
if info[0] not in city_seaweed_dict:
|
if info[0] not in city_seaweed_dict:
|
||||||
city_seaweed_dict[info[0]] = 1
|
city_seaweed_dict[info[0]] = 1
|
||||||
@@ -132,6 +137,7 @@ excel_writer = pd.ExcelWriter(aim_file_name)
|
|||||||
if type == 'sample':
|
if type == 'sample':
|
||||||
result_df = simple_calc(result_df)
|
result_df = simple_calc(result_df)
|
||||||
|
|
||||||
|
result_df = pd.merge(result_df, exclusive_seaweed_df, on=['city', 'region', 'commname'], how='left')
|
||||||
result_df = result_df.drop_duplicates(subset=['commid'], keep='first')
|
result_df = result_df.drop_duplicates(subset=['commid'], keep='first')
|
||||||
result_df = result_df.rename(columns={'city': '城市', 'region': '区域', 'commid': '小区ID', 'commname': '小区名', 'five_price': '上一月价格',
|
result_df = result_df.rename(columns={'city': '城市', 'region': '区域', 'commid': '小区ID', 'commname': '小区名', 'five_price': '上一月价格',
|
||||||
'five_calc_type': '上一月计算方式', 'six_price': '当月价格', 'six_calc_type': '当月计算方式', 'confidence': '置信度'})
|
'five_calc_type': '上一月计算方式', 'six_price': '当月价格', 'six_calc_type': '当月计算方式', 'confidence': '置信度'})
|
||||||
|
|||||||
Reference in New Issue
Block a user