优化
This commit is contained in:
@@ -2,11 +2,14 @@ from goojia_utils import DIDATA_DEV_ELASTIC_CLIENT, dateutils, MAIN_MONGO_CLIENT
|
|||||||
import pandas as pd
|
import pandas as pd
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
from pymongo import UpdateOne
|
from pymongo import UpdateOne
|
||||||
import sys
|
import logging
|
||||||
|
|
||||||
|
log = logging.getLogger(__name__)
|
||||||
|
|
||||||
office_sell_stat_conn = MAIN_MONGO_CLIENT.get_collection('fangjia_stat', 'office_sell_stat')
|
office_sell_stat_conn = MAIN_MONGO_CLIENT.get_collection('fangjia_stat', 'office_sell_stat')
|
||||||
office_rent_stat_conn = MAIN_MONGO_CLIENT.get_collection('fangjia_stat', 'office_rent_stat')
|
office_rent_stat_conn = MAIN_MONGO_CLIENT.get_collection('fangjia_stat', 'office_rent_stat')
|
||||||
|
|
||||||
|
|
||||||
def calc(city, year_month):
|
def calc(city, year_month):
|
||||||
query = {'date': year_month, 'cat': 'office'}
|
query = {'date': year_month, 'cat': 'office'}
|
||||||
if pd.notna(city):
|
if pd.notna(city):
|
||||||
@@ -44,6 +47,9 @@ def calc(city, year_month):
|
|||||||
item['sell_price'] = round(city_radio[item['city']] * item['rent_price'] * 30 * 12, 0)
|
item['sell_price'] = round(city_radio[item['city']] * item['rent_price'] * 30 * 12, 0)
|
||||||
return item
|
return item
|
||||||
|
|
||||||
|
if len(merge2_df) == 0:
|
||||||
|
print(city + "无数据补充")
|
||||||
|
return
|
||||||
merge2_df = threads.process_dataframe_multithread(merge2_df, deal, 10)
|
merge2_df = threads.process_dataframe_multithread(merge2_df, deal, 10)
|
||||||
merge2_df = merge2_df[merge2_df['sell_price'].notna()]
|
merge2_df = merge2_df[merge2_df['sell_price'].notna()]
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user