[GIS] ArcPy Dissolve Statistics Fields

arcpypython

While running a Dissolve, when using statistics fields, I keep getting an error that the parameters are not valid.

enter image description here

Here is my code:

toBeDissolved = r"D:\TestingAfterMeeting\toBeDeletedTestingData\output.shp"
output = r'D:\TestingAfterMeeting\toBeDeletedTestingData\TestingDissolve\output_diss.shp'

arcpy.Dissolve_management(toBeDissolved,output,dissolve_field='Code_CLDC',statistics_fields=[['Code_DDA','LAST'],['Code_Provi','LAST'],['Number_CLD ','LAST']])

Been looking at it for a while… maybe someone else sees the mistake.

Best Answer

Great... the second it is posted I spot the mistake.

There was an extra white space in one of my fields (Number_CLD). I wish the error messages in ArcPy were sometimes more helpful.

Here is the working code:

toBeDissolved = r"D:\TestingAfterMeeting\toBeDeletedTestingData\output.shp"
output = r'D:\TestingAfterMeeting\toBeDeletedTestingData\TestingDissolve\output_diss.shp'

arcpy.Dissolve_management(toBeDissolved,output,dissolve_field='Code_CLDC',statistics_fields=[['Code_DDA','LAST'],['Code_Provi','LAST'],['Number_CLD','LAST']])
Related Question