I have a vector layer in which I have added some fields of type 'float' using arcpy.AddField_management. I'm performing simple calculations between those fields using update cursors but the problem is that when I divide the values by 0, I get a run-time error even though I'm using Inf with the float function.
This is my code:
with arcpy.da.UpdateCursor('flurstcuke_cropped5', ['FID','totresgeb', 'totresgbpt','difresarea','scaledif']) as cursor6: for row6 in cursor6: row6 = row6 - row6 try: row6 = ((row6 - row6)/row6) * 100 except ZeroDivisionError: row6 = float('INF') cursor6.updateRow([row6, row6, row6, row6, row6])
The message I get is that 'the value type is incompatible with the field type. [scaledif].' And I know it's referring to Inf since I have also set up a counter in my script to determine where the program is. But I don't understand that since 'Inf' is a floating number here and the field's type is also float