新增字段area_ha(公顷),并计算出来:
arcpy.AddField_management('区界',"area_ha","DOUBLE")
>>> arcpy.CalculateField_management("区界","area_ha","!AREA!/10000","PYTHON_9.3")
运算界面:
输出结果:
新增字段area_MU(亩),并计算出来:
arcpy.AddField_management('区界',"area_MU","DOUBLE")
... arcpy.CalculateField_management("区界","area_MU","!AREA!/10000*15","PYTHON_9.3")
运算界面:
输出结果:
合并两个字段:area_MU和NAME99:
使用format函数进行格式化,如果字段里有中文,需要加前缀u,表示unicode编码,如果没有中文,就不需要加。
arcpy.AddField_management("区界","fullName","TEXT")
... arcpy.CalculateField_management("区界","fullName","u'{}{}'.format(!area_MU!,!NAME99!)","PYTHON")
运算界面:
输出界面: