From 6289e30cfee6169b7246dce0e81b4086626448c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E6=96=87=E8=89=B3?= Date: Wed, 24 Dec 2025 10:00:41 +0800 Subject: [PATCH 1/5] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E8=82=A1=E7=A5=A8?= =?UTF-8?q?=E8=A1=A8=E7=BB=93=E6=9E=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dags/ai/dag_ai_stock.py | 8 +++++++- dags/ai/stock/{stock_new.py => stock_strategy.py} | 0 2 files changed, 7 insertions(+), 1 deletion(-) rename dags/ai/stock/{stock_new.py => stock_strategy.py} (100%) diff --git a/dags/ai/dag_ai_stock.py b/dags/ai/dag_ai_stock.py index 636c1c5..dd128a6 100644 --- a/dags/ai/dag_ai_stock.py +++ b/dags/ai/dag_ai_stock.py @@ -10,8 +10,14 @@ with DAG( catchup=True, tags=["ai_stock"], ) as dag: + t1 = BashOperator( + task_id='stock_strategy', + bash_command='python /opt/airflow/dags/repo/dags/ai/stock/stock_strategy.py', + ) + + t2 = BashOperator( task_id='ai_stock', bash_command='python /opt/airflow/dags/repo/dags/ai/stock/stock.py', ) - t1 + t1 >> t2 \ No newline at end of file diff --git a/dags/ai/stock/stock_new.py b/dags/ai/stock/stock_strategy.py similarity index 100% rename from dags/ai/stock/stock_new.py rename to dags/ai/stock/stock_strategy.py From ab7d06194667ec8b138b483655a718f065dce23d Mon Sep 17 00:00:00 2001 From: wangwenyan Date: Mon, 29 Dec 2025 12:00:33 +0800 Subject: [PATCH 2/5] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=8C=BA=E5=9F=9F?= =?UTF-8?q?=E8=B4=A2=E5=8A=9B=E8=AF=84=E7=BA=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dags/office/rent/base_price.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/dags/office/rent/base_price.py b/dags/office/rent/base_price.py index f11a556..6e3a70e 100644 --- a/dags/office/rent/base_price.py +++ b/dags/office/rent/base_price.py @@ -1,6 +1,11 @@ """ 写字楼基准价 """ +import math +from datetime import datetime + +import numpy as np +import pandas as pd # 第一步:计算有样本写字楼的基准价 # 取近一年,最近100个样本的中位值 # 第二步:计算无样本写字楼的基准价 @@ -10,13 +15,8 @@ # # 第五步:本身没有等级和类型的写字楼 # 最近10个有样本写字楼的基准价的平均值 -from goojia_utils import ElasticSearchClient, dateutils, MAIN_MONGO_CLIENT, commutils -import pandas as pd -from datetime import datetime +from goojia_utils import ElasticSearchClient, dateutils, MAIN_MONGO_CLIENT from pymongo import UpdateOne -import math -import numpy as np -import sys es = ElasticSearchClient(host='192.168.0.206') seaweed_df = MAIN_MONGO_CLIENT.get_collection('fangjia', 'seaweed') From 4b9c8f6d192bad8b149bdcb424888be228eee14d Mon Sep 17 00:00:00 2001 From: wangwenyan Date: Mon, 29 Dec 2025 15:01:39 +0800 Subject: [PATCH 3/5] =?UTF-8?q?=E7=A7=BB=E9=99=A4=E6=97=A0=E7=94=A8?= =?UTF-8?q?=E7=9A=84=E5=B7=A5=E5=85=B7=E5=8C=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dags/office/sell/base_price.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/dags/office/sell/base_price.py b/dags/office/sell/base_price.py index c0c10f6..16a875b 100644 --- a/dags/office/sell/base_price.py +++ b/dags/office/sell/base_price.py @@ -1,6 +1,11 @@ """ 写字楼基准价 """ +import math +from datetime import datetime + +import numpy as np +import pandas as pd # 第一步:计算有样本写字楼的基准价 # 取近一年,最近100个样本的中位值 # 第二步:计算无样本写字楼的基准价 @@ -10,13 +15,8 @@ # # 第五步:本身没有等级和类型的写字楼 # 最近10个有样本写字楼的基准价的平均值 -from goojia_utils import ElasticSearchClient, dateutils, MAIN_MONGO_CLIENT, commutils -import pandas as pd -from datetime import datetime +from goojia_utils import ElasticSearchClient, dateutils, MAIN_MONGO_CLIENT from pymongo import UpdateOne -import math -import numpy as np -import sys es = ElasticSearchClient(host='192.168.0.206') seaweed_df = MAIN_MONGO_CLIENT.get_collection('fangjia', 'seaweed') From 8fd76993fc4a576be18c5e998e189258f0bc7712 Mon Sep 17 00:00:00 2001 From: wangwenyan Date: Mon, 29 Dec 2025 15:16:42 +0800 Subject: [PATCH 4/5] =?UTF-8?q?=E7=A7=BB=E9=99=A4=E6=97=A0=E7=94=A8?= =?UTF-8?q?=E7=9A=84=E5=B7=A5=E5=85=B7=E5=8C=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dags/office/sell/base_price.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dags/office/sell/base_price.py b/dags/office/sell/base_price.py index 16a875b..a92c708 100644 --- a/dags/office/sell/base_price.py +++ b/dags/office/sell/base_price.py @@ -112,7 +112,7 @@ def calcByOffice(city, district, office_name): average_price = np.mean(avg_prices) if len(avg_prices) > 0 else 0 if average_price > 0: new_avg_price = int(average_price) - else: + elif "avg_price" in sample.columns: # 取样本的平均值 new_avg_price = int(sample['avg_price'].mean()) if pd.notna(new_avg_price): From 740353e0a718e208520db32beafe9e512c795e7a Mon Sep 17 00:00:00 2001 From: wangwenyan Date: Mon, 29 Dec 2025 15:18:14 +0800 Subject: [PATCH 5/5] =?UTF-8?q?=E7=A7=BB=E9=99=A4=E6=97=A0=E7=94=A8?= =?UTF-8?q?=E7=9A=84=E5=B7=A5=E5=85=B7=E5=8C=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dags/office/sell/base_price.py | 1 + 1 file changed, 1 insertion(+) diff --git a/dags/office/sell/base_price.py b/dags/office/sell/base_price.py index a92c708..acca095 100644 --- a/dags/office/sell/base_price.py +++ b/dags/office/sell/base_price.py @@ -110,6 +110,7 @@ def calcByOffice(city, district, office_name): avg_prices = [doc["avg_price"] for doc in avg_price_ret] # 计算平均值 average_price = np.mean(avg_prices) if len(avg_prices) > 0 else 0 + new_avg_price = None if average_price > 0: new_avg_price = int(average_price) elif "avg_price" in sample.columns: