优化映射别名
This commit is contained in:
@@ -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',
|
||||
|
||||
Reference in New Issue
Block a user