优化drop index
This commit is contained in:
@@ -96,8 +96,7 @@ def sync(city=None):
|
|||||||
seaweed_df = pd.read_csv(path + '/seaweed.csv', sep='@', encoding='UTF-8')
|
seaweed_df = pd.read_csv(path + '/seaweed.csv', sep='@', encoding='UTF-8')
|
||||||
if pd.notna(city):
|
if pd.notna(city):
|
||||||
seaweed_df = seaweed_df[seaweed_df['city'] == city].copy()
|
seaweed_df = seaweed_df[seaweed_df['city'] == city].copy()
|
||||||
seaweed_df = seaweed_df.reset_index()
|
seaweed_df = seaweed_df.reset_index(drop=True)
|
||||||
seaweed_df = seaweed_df.drop(columns=['index'])
|
|
||||||
|
|
||||||
actions = list()
|
actions = list()
|
||||||
with ThreadPoolExecutor(max_workers=30) as pool:
|
with ThreadPoolExecutor(max_workers=30) as pool:
|
||||||
|
|||||||
@@ -78,8 +78,7 @@ def sync(city=None):
|
|||||||
seaweed_df = pd.read_csv(path + '/seaweed.csv', sep='@', encoding='UTF-8')
|
seaweed_df = pd.read_csv(path + '/seaweed.csv', sep='@', encoding='UTF-8')
|
||||||
if pd.notna(city):
|
if pd.notna(city):
|
||||||
seaweed_df = seaweed_df[seaweed_df['city'] == city].copy()
|
seaweed_df = seaweed_df[seaweed_df['city'] == city].copy()
|
||||||
seaweed_df = seaweed_df.reset_index()
|
seaweed_df = seaweed_df.reset_index(drop=True)
|
||||||
seaweed_df = seaweed_df.drop(columns=['index'])
|
|
||||||
|
|
||||||
actions = list()
|
actions = list()
|
||||||
with ThreadPoolExecutor(max_workers=30) as pool:
|
with ThreadPoolExecutor(max_workers=30) as pool:
|
||||||
|
|||||||
@@ -79,8 +79,7 @@ def sync(city=None):
|
|||||||
seaweed_df = pd.read_csv(path + '/seaweed.csv', sep='@', encoding='UTF-8')
|
seaweed_df = pd.read_csv(path + '/seaweed.csv', sep='@', encoding='UTF-8')
|
||||||
if pd.notna(city):
|
if pd.notna(city):
|
||||||
seaweed_df = seaweed_df[seaweed_df['city'] == city].copy()
|
seaweed_df = seaweed_df[seaweed_df['city'] == city].copy()
|
||||||
seaweed_df = seaweed_df.reset_index()
|
seaweed_df = seaweed_df.reset_index(drop=True)
|
||||||
seaweed_df = seaweed_df.drop(columns=['index'])
|
|
||||||
|
|
||||||
actions = list()
|
actions = list()
|
||||||
with ThreadPoolExecutor(max_workers=30) as pool:
|
with ThreadPoolExecutor(max_workers=30) as pool:
|
||||||
|
|||||||
@@ -60,8 +60,7 @@ def sync(city=None):
|
|||||||
seaweed_df = pd.read_csv(path + '/seaweed.csv', sep='@', encoding='UTF-8')
|
seaweed_df = pd.read_csv(path + '/seaweed.csv', sep='@', encoding='UTF-8')
|
||||||
if pd.notna(city):
|
if pd.notna(city):
|
||||||
seaweed_df = seaweed_df[seaweed_df['city'] == city].copy()
|
seaweed_df = seaweed_df[seaweed_df['city'] == city].copy()
|
||||||
seaweed_df = seaweed_df.reset_index()
|
seaweed_df = seaweed_df.reset_index(drop=True)
|
||||||
seaweed_df = seaweed_df.drop(columns=['index'])
|
|
||||||
|
|
||||||
def find_around_price_item(index, item):
|
def find_around_price_item(index, item):
|
||||||
if index % 1000 == 0:
|
if index % 1000 == 0:
|
||||||
|
|||||||
@@ -61,8 +61,7 @@ def sync(city=None):
|
|||||||
seaweed_df = pd.read_csv(path + '/seaweed.csv', sep='@', encoding='UTF-8')
|
seaweed_df = pd.read_csv(path + '/seaweed.csv', sep='@', encoding='UTF-8')
|
||||||
if pd.notna(city):
|
if pd.notna(city):
|
||||||
seaweed_df = seaweed_df[seaweed_df['city'] == city].copy()
|
seaweed_df = seaweed_df[seaweed_df['city'] == city].copy()
|
||||||
seaweed_df = seaweed_df.reset_index()
|
seaweed_df = seaweed_df.reset_index(drop=True)
|
||||||
seaweed_df = seaweed_df.drop(columns=['index'])
|
|
||||||
|
|
||||||
# 加载库中均价数据
|
# 加载库中均价数据
|
||||||
query_sql = "SELECT city, region, name, avg_price FROM community_summary "
|
query_sql = "SELECT city, region, name, avg_price FROM community_summary "
|
||||||
|
|||||||
@@ -74,8 +74,12 @@ with DAG(
|
|||||||
# task_id='extra_dag',
|
# task_id='extra_dag',
|
||||||
# bash_command='python /opt/airflow/dags/repo/dags/business/business/community/extra.py {{dag_run.conf["type"] if "type" in dag_run.conf}}',
|
# bash_command='python /opt/airflow/dags/repo/dags/business/business/community/extra.py {{dag_run.conf["type"] if "type" in dag_run.conf}}',
|
||||||
# )
|
# )
|
||||||
t16 = BashOperator(
|
# t16 = BashOperator(
|
||||||
task_id='other_dag',
|
# task_id='other_dag',
|
||||||
bash_command='python /opt/airflow/dags/repo/dags/business/business/community/other.py {{dag_run.conf["type"] if "type" in dag_run.conf}}',
|
# bash_command='python /opt/airflow/dags/repo/dags/business/business/community/other.py {{dag_run.conf["type"] if "type" in dag_run.conf}}',
|
||||||
|
# )
|
||||||
|
t17 = BashOperator(
|
||||||
|
task_id='business_district_dag',
|
||||||
|
bash_command='python /opt/airflow/dags/repo/dags/business/business/community/business_district.py {{dag_run.conf["type"] if "type" in dag_run.conf}}',
|
||||||
)
|
)
|
||||||
# t1 >> t2 >> t3 >> t4 >> t5 >> t6 >> t6_1 >> t7 >> t8 >> t9 >> t10 >> t11 >> t12 >> t13 >> t14 >> t15 >> t16
|
# t1 >> t2 >> t3 >> t4 >> t5 >> t6 >> t6_1 >> t7 >> t8 >> t9 >> t10 >> t11 >> t12 >> t13 >> t14 >> t15 >> t16
|
||||||
|
|||||||
Reference in New Issue
Block a user