This commit is contained in:
2023-03-20 18:28:08 +08:00
parent ba51ae5ee3
commit 940f7d85e9
+4 -2
View File
@@ -7,6 +7,7 @@ from pykalman import KalmanFilter
from pymongo import UpdateOne from pymongo import UpdateOne
import transbigdata as tbd import transbigdata as tbd
from sklearn.neighbors import NearestNeighbors from sklearn.neighbors import NearestNeighbors
from sqlalchemy import create_engine
year_month = int(dateutils.format_date(dateutils.add_months(datetime.now(), months=-2), '%Y%m')) year_month = int(dateutils.format_date(dateutils.add_months(datetime.now(), months=-2), '%Y%m'))
before_year_month = int(dateutils.format_date(dateutils.add_months(datetime.now(), years=-1, months=-1), '%Y%m')) before_year_month = int(dateutils.format_date(dateutils.add_months(datetime.now(), years=-1, months=-1), '%Y%m'))
@@ -83,10 +84,11 @@ monthly_data.loc[(monthly_data["异常第三方"].isna()) & (monthly_data.dbscan
monthly_data = monthly_data.sort_values(by=["city", "region", "name"]) monthly_data = monthly_data.sort_values(by=["city", "region", "name"])
# In[14]: # In[14]:
# community_base_price = oracle.scan_by_sql_to_data_frame(f"select commid, year_month, avg_price, calc_type,confidence, cityname from community_base_price_gj where year_month > {before_year_month}")
community_base_price = oracle.scan_by_sql_to_data_frame( engine = create_engine("postgresql+psycopg2://postgres:postgres@192.168.0.236:5432/warehouse", echo=False)
f"select commid, year_month, avg_price, calc_type,confidence, cityname from community_base_price_gj where year_month > {before_year_month}") community_base_price = pd.read_sql(f"select gujia_bds_id as commid,gujiabds_clc_yrmo_val as year_month, gujia_comm_basic_prc as avg_price, urbn_nm as cityname,gujia_bds_clmtd as calc_type, gujia_bds_cfdrg as confidence from t_app_p9pha_plda.avm_community_base_price_gj_h where gujiabds_clc_yrmo_val>{before_year_month} ", con=engine)
community_base_price = community_base_price.sort_values(by=['commid', 'year_month'], ascending=[True, True]) community_base_price = community_base_price.sort_values(by=['commid', 'year_month'], ascending=[True, True])
# In[15]: # In[15]: