新增极值

This commit is contained in:
shenjian@fangjia.com
2022-11-22 09:26:41 +08:00
parent 0588704e96
commit 3b6ed4ae4b
3 changed files with 5 additions and 4 deletions
@@ -1,7 +1,7 @@
"""
月消费潜力、评级计算
"""
from goojia_utils import ElasticSearchClient
from goojia_utils import ElasticSearchClient, dateutils
import pandas as pd
import numpy as np
import logging
@@ -40,7 +40,6 @@ def calc_consumption_potential(city):
community_summary_df.loc[community_summary_df['estate_charge'] > factor_dict[city]['max_estate_charge'], 'estate_charge'] = factor_dict[city]['max_estate_charge']
community_summary_df.loc[community_summary_df['avg_cost'] < factor_dict[city]['min_avg_cost'], 'avg_cost'] = factor_dict[city]['min_avg_cost']
community_summary_df.loc[community_summary_df['avg_cost'] > factor_dict[city]['max_avg_cost'], 'avg_cost'] = factor_dict[city]['max_avg_cost']
community_summary_df['total_price'] = community_summary_df['total_price'] / 10000
community_summary_df['total_price_mean'] = community_summary_df.groupby(by=['city'])['total_price'].transform(
@@ -112,6 +111,7 @@ def calc_consumption_rating(community_summary_df):
_id = str(item["_id"])
row['consumption_rating'] = item['consumption_rating']
row['consumption_potential'] = item['consumption_potential']
row['m_date'] = dateutils.iso_format()
action = {'_op_type': 'update', # 操作 index update create delete
'_index': index_name, # index
@@ -136,4 +136,5 @@ def sync(city=None):
community_summary_df = calc_consumption_potential(city)
calc_consumption_rating(community_summary_df)
sync()
@@ -3,7 +3,6 @@
"""
from goojia_utils import ElasticSearchClient
import pandas as pd
import numpy as np
import logging
from elasticsearch import helpers
@@ -87,4 +86,5 @@ def sync(city=None):
community_summary_df.loc[community_summary_df['estate_charge'] > factor_dict[city]['max_estate_charge'], 'estate_charge'] = factor_dict[city]['max_estate_charge']
calc_estate_charge_rating(community_summary_df)
sync('上海')
sync()