户均总价补全调整

This commit is contained in:
shenjian@fangjia.com
2023-03-10 13:15:10 +08:00
parent 437bb336bd
commit 98466f4b22
2 changed files with 9 additions and 17 deletions
@@ -49,13 +49,6 @@ def save(community_factor_df):
actions.clear()
def complete_by_area(community_df):
factor_df = pd.read_csv(path + '/小区户均总价面积因子已去极值.csv', sep='@', encoding='UTF-8')
community_factor_df = pd.merge(community_df, factor_df, how='left', on=['_id', 'city', 'region', 'name'])
community_factor_df['total_price'] = community_factor_df['avg_price'] * community_factor_df['factor']
return community_factor_df
def complete_by_build_year_area(community_factor_df):
build_year_area_df = pd.read_excel(path + '/全国各区各建筑年代户均面积已去极值.xlsx')
build_year_area_dict = dict()
@@ -114,10 +107,10 @@ def sync(city=None):
community_df = es206_client.scan_by_sql_to_data_frame(sql)
if len(community_df) > 0:
community_factor_df = complete_by_area(community_df)
complete_by_build_year_area(community_factor_df)
complete_by_region_area(community_factor_df)
save(community_factor_df)
community_df['total_price'] = None
complete_by_build_year_area(community_df)
complete_by_region_area(community_df)
save(community_df)
log.info(f"完成补全户均总价信息至206 {index_name}")
+5 -6
View File
@@ -34,11 +34,10 @@ with DAG(
task_id='total_price',
bash_command='python /opt/airflow/dags/repo/dags/business/business/community/total_price.py {{dag_run.conf["city"] if "city" in dag_run.conf}}',
)
# 采用户均总价计算新方式,无需补充
# total_price_complete = BashOperator(
# task_id='total_price_complete',
# bash_command='python /opt/airflow/dags/repo/dags/business/business/community/total_price_complete.py {{dag_run.conf["city"] if "city" in dag_run.conf}}',
# )
total_price_complete = BashOperator(
task_id='total_price_complete',
bash_command='python /opt/airflow/dags/repo/dags/business/business/community/total_price_complete.py {{dag_run.conf["city"] if "city" in dag_run.conf}}',
)
traffic = BashOperator(
task_id='traffic',
bash_command='python /opt/airflow/dags/repo/dags/business/business/community/traffic.py {{dag_run.conf["city"] if "city" in dag_run.conf}}',
@@ -96,4 +95,4 @@ with DAG(
bash_command='python /opt/airflow/dags/repo/dags/business/business/community/other.py {{dag_run.conf["city"] if "city" in dag_run.conf}}',
)
# 人均消费并行,值为空
comm >> price >> [avg_cost, total_price, relative_price_ranking, estate_charge_complete] >> consumption >> [estate_charge_ranking, price_rating, person_rating] >> sell >> trade >> [traffic, business_district, medical, life, education] >> education2 >> extra >> other
comm >> price >> [avg_cost, total_price, relative_price_ranking, estate_charge_complete] >> total_price_complete >> consumption >> [estate_charge_ranking, price_rating, person_rating] >> sell >> trade >> [traffic, business_district, medical, life, education] >> education2 >> extra >> other