优化更新
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
"""
|
||||
写字楼基准价计算
|
||||
"""
|
||||
from airflow.operators.bash import BashOperator
|
||||
|
||||
import pendulum
|
||||
|
||||
from airflow import DAG
|
||||
|
||||
with DAG(
|
||||
dag_id="base_price_dag",
|
||||
schedule_interval="0 1 27 * *",
|
||||
start_date=pendulum.datetime(2025, 2, 28, tz="Asia/Shanghai"),
|
||||
catchup=True,
|
||||
description="写字楼基准价计算"
|
||||
) as dag:
|
||||
t1 = BashOperator(
|
||||
task_id='base_price',
|
||||
bash_command='python /opt/airflow/dags/repo/dags/office/rent/base_price.py',
|
||||
)
|
||||
t1
|
||||
|
||||
@@ -251,7 +251,10 @@ def calc(city, year_month):
|
||||
actions.clear()
|
||||
|
||||
# 第五步
|
||||
db_df = pd.DataFrame(list(office_rent_stat_conn.find({'cat': 'office', 'date': year_month, 'calc_type': {'$in': [1, 2, 3]}})))
|
||||
query = {'cat': 'office', 'date': year_month, 'calc_type': {'$in': [1, 2, 3]}}
|
||||
if pd.notna(city):
|
||||
query['city'] = city
|
||||
db_df = pd.DataFrame(list(office_rent_stat_conn.find(query)))
|
||||
office_info = office[['city', 'region', 'name', 'lng', 'lat', 'estate_type2', 'bed_kind']].drop_duplicates(
|
||||
keep='first')
|
||||
# 计算价格的写字楼
|
||||
@@ -301,7 +304,7 @@ def calc(city, year_month):
|
||||
actions.clear()
|
||||
office_rent_stat_conn.bulk_write(actions)
|
||||
|
||||
# for year_month in range(202406, 202501):
|
||||
# print(year_month)
|
||||
# calc('上海', year_month)
|
||||
calc('上海', 202412)
|
||||
for year_month in range(202406, 202501):
|
||||
print(year_month)
|
||||
calc(None, year_month)
|
||||
#calc('上海', 202412)
|
||||
Reference in New Issue
Block a user