While figuring out what I have to do, practically creating a field for each arrondise, and in each, rank each FID (which are part of the respective arrondise) by the size of its shape area.
Hopefully, it is a bit clear now.
EDIT Currently, trying to rank each row which is part of a certain arrondise (ex. 1, 2) in terms of its shape area.
import arcpy arcpy.env.workspace = "D:/M1 Geomatique/Programmation II/Dossier" fc = "zones_rattachement.shp" try: fieldRoot = "RANG_R" for counter in range(1,21): arcpy.AddField_management(fc, fieldRoot + str(counter),'SHORT') size_rank = 1 numlist = list(range(1,21)) for num in numlist: arcpy.SelectLayerByAttribute_management(fc, "NEW_SELECTION", "arrondisse = '%c'") rows = arcpy.UpdateCursor(fc, sort_fields="shape_area D") for row in rows: row.setValue("RANG_R1", size_rank) size_rank += 1 rows.updateRow(row) except: arcpy.GetMessages()