新增估值统计
This commit is contained in:
@@ -11,7 +11,7 @@ with DAG(
|
|||||||
) as dag:
|
) as dag:
|
||||||
t1 = BashOperator(
|
t1 = BashOperator(
|
||||||
task_id='district_count_thirdavg_deal',
|
task_id='district_count_thirdavg_deal',
|
||||||
bash_command='python /opt/airflow/dags/repo/dags/stat/evaluate/district_count_thirdavg_deal.py',
|
bash_command='python /opt/airflow/dags/repo/dags/stat/evaluate/district_count_thirdavg_deal.py {{dag_run.conf["city_num"] if "city_num" in dag_run.conf}}',
|
||||||
)
|
)
|
||||||
t2 = BashOperator(
|
t2 = BashOperator(
|
||||||
task_id='district_sell_property',
|
task_id='district_sell_property',
|
||||||
|
|||||||
Binary file not shown.
@@ -6,10 +6,18 @@ from goojia_utils import MAIN_MONGO_CLIENT, ElasticSearchClient, dateutils
|
|||||||
import pandas as pd
|
import pandas as pd
|
||||||
import datetime
|
import datetime
|
||||||
import os
|
import os
|
||||||
|
import sys
|
||||||
|
|
||||||
log = logging.getLogger(__name__)
|
log = logging.getLogger(__name__)
|
||||||
|
|
||||||
df = pd.read_excel('/opt/airflow/dags/repo/dags/stat/evaluate/data/估值数据统计.xlsx')
|
city_num = sys.argv[1] if len(sys.argv) > 1 else None
|
||||||
|
print("输出参数" + city_num)
|
||||||
|
|
||||||
|
df = pd.DataFrame()
|
||||||
|
if city_num == 92:
|
||||||
|
df = pd.read_excel('/opt/airflow/dags/repo/dags/stat/evaluate/data/估值92城市数据统计.xlsx')
|
||||||
|
else:
|
||||||
|
df = pd.read_excel('/opt/airflow/dags/repo/dags/stat/evaluate/data/估值数据统计.xlsx')
|
||||||
year_month_day = dateutils.format_date(datetime.datetime.now())
|
year_month_day = dateutils.format_date(datetime.datetime.now())
|
||||||
path = "/home/airflow/data/evaluate"
|
path = "/home/airflow/data/evaluate"
|
||||||
aim_file_name = path + '/估值数据统计结果' + year_month_day + '.xlsx'
|
aim_file_name = path + '/估值数据统计结果' + year_month_day + '.xlsx'
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ def sell_stat():
|
|||||||
'_id'].transform('size')
|
'_id'].transform('size')
|
||||||
sell_seaweed_merge_df = sell_seaweed_merge_df[['city', 'region', '_id', 'count']]
|
sell_seaweed_merge_df = sell_seaweed_merge_df[['city', 'region', '_id', 'count']]
|
||||||
sell_seaweed_merge_df = sell_seaweed_merge_df.drop_duplicates(subset=['city', 'region', '_id'])
|
sell_seaweed_merge_df = sell_seaweed_merge_df.drop_duplicates(subset=['city', 'region', '_id'])
|
||||||
sell_seaweed_ok_df = sell_seaweed_merge_df[sell_seaweed_merge_df['count'] > 3]
|
sell_seaweed_ok_df = sell_seaweed_merge_df[sell_seaweed_merge_df['count'] >= 3]
|
||||||
sell_seaweed_ok_df['city_seaweed_count'] = sell_seaweed_ok_df.groupby('city')['city'].transform('size')
|
sell_seaweed_ok_df['city_seaweed_count'] = sell_seaweed_ok_df.groupby('city')['city'].transform('size')
|
||||||
city_seaweed_count_df = sell_seaweed_ok_df[['city', 'city_seaweed_count']].drop_duplicates(
|
city_seaweed_count_df = sell_seaweed_ok_df[['city', 'city_seaweed_count']].drop_duplicates(
|
||||||
subset=['city', 'city_seaweed_count'])
|
subset=['city', 'city_seaweed_count'])
|
||||||
@@ -77,7 +77,7 @@ def sell_stat():
|
|||||||
try:
|
try:
|
||||||
sql = "select count(*) from latest_seawater where city='" + city + "' and region='" + region + "' and cat='sell' and district_name in(" + names_str + ") and p_date > " + one_year_time
|
sql = "select count(*) from latest_seawater where city='" + city + "' and region='" + region + "' and cat='sell' and district_name in(" + names_str + ") and p_date > " + one_year_time
|
||||||
num = es206_client.search_by_sql(sql)['hits']['total']['value']
|
num = es206_client.search_by_sql(sql)['hits']['total']['value']
|
||||||
if num > 3:
|
if num >= 3:
|
||||||
count += 1
|
count += 1
|
||||||
total_num += num
|
total_num += num
|
||||||
all_num += num
|
all_num += num
|
||||||
|
|||||||
Reference in New Issue
Block a user