I have a shapefile feature class with the following attribute table:
I set the shapefile symbology using these lines:
lyr.symbology.valueField = "GRIDCODE"
What i get is this:
The color range is not in ascending order. It is starting at "10".
When I click on the color range ("Farbverlauf"), it changes to an ascending order, starting at "2". However, I have too many shapefiles to do this for each single one.
How can I adjust this color assignment in ArcPy?
I'm using this workaround now: How To: Add leading zeros to values in a field in an attribute table
Example code: fill each row of field "GRIDCODE" of layer "lyr" with "002"
with arcpy.da.UpdateCursor(lyr, "GRIDCODE") as cursor:
for row in cursor:
row = (str(2).zfill(3))