I'm trying to add multiple fields to multiple feature classes using a list in ArcGIS Pro. This is my code

import arcpy
arcpy.env.workspace = "Tatjana\MasterGeodatabase\MasterGeodatabase.gdb"

FcList = ['Storm Control Valves', 'Storm Culverts', 'Storm Detention Areas', 'Storm Discharge Points', 'Storm Fittings', 'Storm Gravity Mains', 'Storm Inlets', 'Storm Manholes', 'Storm Network Structures', 'Storm Pressure Mains', 'Storm System Valves']

for fc in FcList:
    arcpy.management.AddFields(fc, 'CONDSCORE', 'FLOAT', 'Condition Score', None, "", "")
    arcpy.management.AddFields(fc, 'CONDDATE', 'DATE', 'Condition Date', None, "", "")
    arcpy.management.AddFields(fc, 'ESTSERVICELIFE', 'FLOAT', 'Est. Service Life', None, "", "")
    arcpy.management.AddFields(fc, 'COST', 'FLOAT', 'Asset Cost', None, "", "")
    arcpy.management.AddFields(fc, 'LIFECYCLESTS', 'TEXT', 'Lifecycle Status', 255, "", "")
    arcpy.management.AddFields(fc, 'RESIDUALLIFE', 'FLOAT', 'Residual Life', None, "", "")
    arcpy.management.AddFields(fc, 'ESTREPLCCOST', 'FLOAT', 'Est. Replacement Cost', None, "", "")
    arcpy.management.AddFields(fc, 'ESTREPLCDATE', 'DATE', 'Est. Replacement Date', None, "", "")
    arcpy.management.AddFields(fc, 'PCTSVCLIFEUSED', 'FLOAT', '% Service Life Consumed ', None, "", "")

When I run the code this is the error I'm getting

TypeError: AddFields() takes from 0 to 2 positional arguments but 7 were given

1 Answer 1


You are using AddField syntax. AddFields takes a feature class and single list of field descriptions as a parameter. Either use AddField or convert your code to use AddFields syntax. E.g.


for fc in FcList:
    arcpy.management.AddField(fc, 'CONDSCORE', 'FLOAT', 'Condition Score', None, "", "")
    arcpy.management.AddField(fc, 'CONDDATE', 'DATE', 'Condition Date', None, "", "")
    arcpy.management.AddField(fc, 'ESTSERVICELIFE', 'FLOAT', 'Est. Service Life', None, "", "")
    arcpy.management.AddField(fc, 'COST', 'FLOAT', 'Asset Cost', None, "", "")
    arcpy.management.AddField(fc, 'LIFECYCLESTS', 'TEXT', 'Lifecycle Status', 255, "", "")
    arcpy.management.AddField(fc, 'RESIDUALLIFE', 'FLOAT', 'Residual Life', None, "", "")
    arcpy.management.AddField(fc, 'ESTREPLCCOST', 'FLOAT', 'Est. Replacement Cost', None, "", "")
    arcpy.management.AddField(fc, 'ESTREPLCDATE', 'DATE', 'Est. Replacement Date', None, "", "")
    arcpy.management.AddField(fc, 'PCTSVCLIFEUSED', 'FLOAT', '% Service Life Consumed ', None, "", "")


for fc in FcList:
    arcpy.management.AddFields(fc, [
        ['CONDSCORE', 'FLOAT', 'Condition Score', None, "", ""],
        ['CONDDATE', 'DATE', 'Condition Date', None, "", ""],
        ['ESTSERVICELIFE', 'FLOAT', 'Est. Service Life', None, "", ""],
        ['COST', 'FLOAT', 'Asset Cost', None, "", ""],
        ['LIFECYCLESTS', 'TEXT', 'Lifecycle Status', 255, "", ""],
        ['RESIDUALLIFE', 'FLOAT', 'Residual Life', None, "", ""],
        ['ESTREPLCCOST', 'FLOAT', 'Est. Replacement Cost', None, "", ""],
        ['ESTREPLCDATE', 'DATE', 'Est. Replacement Date', None, "", ""],
        ['PCTSVCLIFEUSED', 'FLOAT', '% Service Life Consumed ', None, "", ""]])

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.