I'm having trouble rounding a percentage number using a label expression in Python. Just displaying the label as shown below is fine.
def FindLabel ( [Deaths], [PercentageDead] ):
if ([Deaths]) == "0":
return [Deaths]
else:
return [Deaths] + "\n" + [PercentageDead] + "%"
I tried implementing the example given on Arcgis online but as soon as I try to round off the extra digits in my percentage all of those features go blank on my map. No label is displayed whatsoever for those feature.
def FindLabel ( [Deaths], [PercentageDead] ):
if ([Deaths]) == "0":
return [Deaths]
else:
P = round(float([PercentageDead]), 5)
return [Deaths] + "\n" + P + "%"
I've tried converting to a float or an int, and than converting it back to a string but nothing seems to work. If I try to manipulate that field whatsoever the expression will return nothing.
I just want to round off the digits to 5, how would I do that? I'd be willing to switch to Arcade if it would yield the same result.