From 5551d32e5516bfb9e329bb3c781c8911910e8faf Mon Sep 17 00:00:00 2001 From: Jian Shen Date: Thu, 30 Jun 2022 10:31:01 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E6=98=A0=E5=B0=84=E5=88=AB?= =?UTF-8?q?=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dags/mt/supply/comm.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/dags/mt/supply/comm.py b/dags/mt/supply/comm.py index e12ff51..a18d34d 100644 --- a/dags/mt/supply/comm.py +++ b/dags/mt/supply/comm.py @@ -21,7 +21,7 @@ for city in cities: seaweed_df = pd.concat([seaweed_df, temp_df]) seaweed_result_df = seaweed_df[ - ['_id', 'city', 'region', 'name', 'alias', 'address', 'addr_alias', 'lng', 'lat', 'block', 'loop_line_info', + ['_id', 'city', 'region', 'name', 'mapping_alias', 'address', 'addr_alias', 'lng', 'lat', 'block', 'loop_line_info', 'business_quarter', 'household_count', 'estate_charge', 'car_site_count', 'property_life', 'house_property', 'all_area', 'build_area', 'cubage_percent', 'virescence_percent', 'estate_type2', 'build_type', 'build_structure', 'finish_building_date', @@ -35,11 +35,11 @@ def format_seaweed(x): :param x: :return: """ - names = [x.name] try: - if x.alias is not None and str(x.alias) != 'nan': - names.extend(x.alias) - x.alias = ','.join(x.alias) + if str(x.mapping_alias) != 'nan' and x.mapping_alias != None: + if x.name in x.mapping_alias: + x.mapping_alias.remove(x.name) + x.mapping_alias = ','.join(x.mapping_alias) if x.addr_alias is not None and str(x.addr_alias) != 'nan': x.addr_alias = ','.join(x.addr_alias) x.virescence_percent = commutils.format_greening_rate(x.virescence_percent) @@ -61,7 +61,7 @@ def format_seaweed(x): seaweed_new_result_df = seaweed_result_df.apply(lambda x: format_seaweed(x), axis=1) -seaweed_new_result_df = seaweed_new_result_df.rename(columns={'_id': 'id', 'household_count': 'households', 'estate_charge': 'property_fee', +seaweed_new_result_df = seaweed_new_result_df.rename(columns={'_id': 'id', 'mapping_alias': 'alias', 'household_count': 'households', 'estate_charge': 'property_fee', 'cubage_percent' : 'plot_ratio', 'virescence_percent': 'landscaping_ratio', 'estate_type2': 'property_type', 'main_type': 'house_type', 'main_type_area': 'house_area'}) seaweed_new_result_df.to_csv(path + '/FJW_COMM_' + dateutils.format_date(datetime.datetime.now(), '%Y%m') + '.csv',