diff --git a/dags/jh/price/pqsql_connect.py b/dags/jh/price/pqsql_connect.py index 8fc88b7..2df749b 100644 --- a/dags/jh/price/pqsql_connect.py +++ b/dags/jh/price/pqsql_connect.py @@ -68,13 +68,13 @@ def get_sample(cityid): return data_df def get_deal(cityid): - sql = f"select urbn_id,gujia_comm_id,comm_nm,guiabconstructionarea,gujia_bds_trdtckt_prc from base.bigdata_deal_gj_h where urbn_id='{cityid}' and txn_dt >= TO_DATE('2024-03-01','YYYY-MM-DD') and txn_dt < TO_DATE('2024-04-01','YYYY-MM-DD')" + sql = f"select urbn_id,gujia_comm_id,comm_nm,guiabconstructionarea,gujia_bds_trdtckt_prc from base.bigdata_deal where urbn_id='{cityid}' and txn_dt >= TO_DATE('2024-03-01','YYYY-MM-DD') and txn_dt < TO_DATE('2024-04-01','YYYY-MM-DD')" data_df = pgdb.read(sql) data_df = data_df.rename(columns={'urbn_id': 'cityid','gujia_comm_id': '_id','comm_nm': 'name', 'guiabconstructionarea': 'area','gujia_bds_trdtckt_prc': 'deal_price'}) return data_df def get_deal_data(cityid): - sql = f"select * from base.bigdata_deal_gj_h where urbn_id='{cityid}' and txn_dt >= TO_DATE('2024-03-01','YYYY-MM-DD') and txn_dt < TO_DATE('2024-04-01','YYYY-MM-DD')" + sql = f"select * from base.bigdata_deal where urbn_id='{cityid}' and txn_dt >= TO_DATE('2024-03-01','YYYY-MM-DD') and txn_dt < TO_DATE('2024-04-01','YYYY-MM-DD')" data_df = pgdb.read(sql) return data_df diff --git a/dags/jh/price/price_deviation.py b/dags/jh/price/price_deviation.py index 5a47583..c813aa6 100644 --- a/dags/jh/price/price_deviation.py +++ b/dags/jh/price/price_deviation.py @@ -24,7 +24,7 @@ if type == month_last: log.info(f"测试月份:{month_now}") price_df = pgsql.scan_by_sql_to_data_frame(f"select urbn_id,urbn_nm,gujia_admndiv_nm,gujia_bds_id as gujia_comm_id,comm_nm,gujia_bds_clmtd,gujia_comm_basic_prc from price_stat.avm_community_base_price where gujiabds_clc_yrmo_val={month_now} ") -deal_df = pgsql.scan_by_sql_to_data_frame(f"select gujia_bds_mdl_id,gujia_comm_id,gujia_bds_trdtckt_prc from base.bigdata_deal_gj_h where to_char(txn_dt,'yyyyMM')='{month_last}' ") +deal_df = pgsql.scan_by_sql_to_data_frame(f"select gujia_bds_mdl_id,gujia_comm_id,gujia_bds_trdtckt_prc from base.bigdata_deal where to_char(txn_dt,'yyyyMM')='{month_last}' ") deal_price_df = deal_df.merge(price_df, on="gujia_comm_id", how="left") deal_price_df["ppe"] = round((deal_price_df["gujia_comm_basic_prc"] - deal_price_df['gujia_bds_trdtckt_prc']) / deal_price_df['gujia_bds_trdtckt_prc'], 4) #deal_price_df = deal_price_df[abs(deal_price_df['ppe']) > 0.15]