I have a text field with temperatures in it (mostly numbers, but some with "unknown temperature") that I want to calculate to an integer field so I can create symbols using a quantitative classification.
In ArcGIS I could calculate using [TempF].asNumber but I can't find a similar function in ArcPro.
If you text field only contains integers, as text, or a text value, you can use !yourfield!.isdigit() using a python parser. If your field contains floating point values as text or a text value, then there is more work to do.
>>> a
'1'
>>> b
'1.1'
>>> a.isdigit()
True
>>> b.isdigit()
False
>>> b.isalnum()
False
so before giving a code block to cover the cases for floating point values, values in scientific notation, NaNs and complex, see if you have just integers (as text) or text
I see how this tests to see if the text value is integer, but how do I change it to integer? Thank you!
in the field calculator, python parser
int(!Your_Fieldname_here!) # note the ! before and after the field name
>>> a = '1234'
>>> int(a)
1234
You may wish to move this thread to https://community.esri.com/community/gis/applications/arcgis-pro?sr=search&searchId=9ac689ca-14f7-45... to get a wider audience, you have published in a group with limited membership