新增独家小区输出
This commit is contained in:
@@ -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 logging
|
||||
import os
|
||||
import sys
|
||||
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):
|
||||
"""
|
||||
@@ -132,6 +137,7 @@ excel_writer = pd.ExcelWriter(aim_file_name)
|
||||
if type == 'sample':
|
||||
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.rename(columns={'city': '城市', 'region': '区域', 'commid': '小区ID', 'commname': '小区名', 'five_price': '上一月价格',
|
||||
'five_calc_type': '上一月计算方式', 'six_price': '当月价格', 'six_calc_type': '当月计算方式', 'confidence': '置信度'})
|
||||
@@ -147,6 +153,6 @@ city_count_df.to_excel(excel_writer, index=False, sheet_name='城市维度')
|
||||
#excel_writer.save()
|
||||
excel_writer.close()
|
||||
|
||||
#up_to_nextcloud()
|
||||
up_to_nextcloud()
|
||||
|
||||
#send_msg()
|
||||
send_msg()
|
||||
Reference in New Issue
Block a user