新增统计
This commit is contained in:
+1
-1
@@ -27,6 +27,6 @@ with DAG(
|
|||||||
)
|
)
|
||||||
t5 = BashOperator(
|
t5 = BashOperator(
|
||||||
task_id='mt_stat',
|
task_id='mt_stat',
|
||||||
bash_command='python /opt/airflow/dags/repo/dags/mt/supply/stat.py',
|
bash_command='python /opt/airflow/dags/repo/dags/mt/supply/data_stat.py',
|
||||||
)
|
)
|
||||||
t1 >> t2 >> t3 >> t4 >> t5
|
t1 >> t2 >> t3 >> t4 >> t5
|
||||||
|
|||||||
@@ -15,10 +15,12 @@ cities = city_df['城市列表'].values.tolist()
|
|||||||
actions = list()
|
actions = list()
|
||||||
for city in cities:
|
for city in cities:
|
||||||
action = dict()
|
action = dict()
|
||||||
|
temp_df = result_df[result_df['city'] == city]
|
||||||
|
# 小区量
|
||||||
|
action['curr_city'] = city
|
||||||
|
action['count'] = len(temp_df)
|
||||||
for item in result_df.columns:
|
for item in result_df.columns:
|
||||||
temp_df = result_df[result_df['city'] == city]
|
|
||||||
action[item] = round(len(temp_df[temp_df[item].notna()]) * 100 / len(temp_df), 2)
|
action[item] = round(len(temp_df[temp_df[item].notna()]) * 100 / len(temp_df), 2)
|
||||||
action[city] = city
|
|
||||||
if action['rent_price'] < 90:
|
if action['rent_price'] < 90:
|
||||||
action['rent_flag'] = '租金覆盖率低于90%'
|
action['rent_flag'] = '租金覆盖率低于90%'
|
||||||
if action['avg_price'] < 90:
|
if action['avg_price'] < 90:
|
||||||
@@ -27,7 +29,7 @@ for city in cities:
|
|||||||
|
|
||||||
df = pd.DataFrame(actions)
|
df = pd.DataFrame(actions)
|
||||||
aim_file_name = path + "/" + dateutils.format_date(datetime.datetime.now(), '%Y%m') + '覆盖率统计.xlsx'
|
aim_file_name = path + "/" + dateutils.format_date(datetime.datetime.now(), '%Y%m') + '覆盖率统计.xlsx'
|
||||||
df.to_excel(aim_file_name)
|
df.to_excel(aim_file_name, index=False)
|
||||||
|
|
||||||
def up_to_nextcloud():
|
def up_to_nextcloud():
|
||||||
"""
|
"""
|
||||||
@@ -31,6 +31,8 @@ path = "/home/airflow/data/mt"
|
|||||||
|
|
||||||
result_df = pd.read_csv(path + '/FJW_COMM_' + dateutils.format_date(datetime.datetime.now(), '%Y%m') + '.csv', sep='@', encoding='utf-8')
|
result_df = pd.read_csv(path + '/FJW_COMM_' + dateutils.format_date(datetime.datetime.now(), '%Y%m') + '.csv', sep='@', encoding='utf-8')
|
||||||
|
|
||||||
|
if 'deal_num' in result_df.columns:
|
||||||
|
result_df = result_df.drop(columns=['deal_num'])
|
||||||
"""
|
"""
|
||||||
MONGO城市成交数据
|
MONGO城市成交数据
|
||||||
"""
|
"""
|
||||||
|
|||||||
Reference in New Issue
Block a user