Convert numbers in a text field to an integer field

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.

MVP Emeritus

by DanPatterson_Re tired

MVP Emeritus ‎09-16-2016 11:17 AM

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