From 48ceec276008f1e388bd2cf9b64c6be03059600d Mon Sep 17 00:00:00 2001 From: "shenjian@fangjia.com" Date: Thu, 9 Mar 2023 16:28:43 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dags/business/business/community/avg_cost.py | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/dags/business/business/community/avg_cost.py b/dags/business/business/community/avg_cost.py index 255f898..b52ffe3 100644 --- a/dags/business/business/community/avg_cost.py +++ b/dags/business/business/community/avg_cost.py @@ -109,17 +109,20 @@ def sync(city=None): print(lat) print(price) print(index) - seaweed_df.loc[index, 'avg_cost'] = price + if pd.notna(price): + seaweed_df.loc[index, 'avg_cost'] = int(price) + else: + seaweed_df.loc[index, 'avg_cost'] = None if item['_id'] == '50bd172ae4b0fbe60a6fe628': print(seaweed_df.loc[index]) - with ThreadPoolExecutor(max_workers=30) as pool: - for index, item in seaweed_df.iterrows(): - pool.submit(find_around_price_item, index, item) - # for index, item in seaweed_df.iterrows(): - # find_around_price_item(index, item) + # with ThreadPoolExecutor(max_workers=30) as pool: + # for index, item in seaweed_df.iterrows(): + # pool.submit(find_around_price_item, index, item) + for index, item in seaweed_df[seaweed_df['_id'] == '50bd172ae4b0fbe60a6fe628'].iterrows(): + find_around_price_item(index, item) actions = list() count = 0 - for index, item in seaweed_df.iterrows(): + for index, item in seaweed_df[seaweed_df['_id'] == '50bd172ae4b0fbe60a6fe628'].iterrows(): if item['_id'] == '50bd172ae4b0fbe60a6fe628': print(item) doc_info = build_doc(item)