1

I'm trying to convert text to numeric, but am unable to in ArcGIS Pro.

Is there a Python function?

I tried int(!FieldName!) but I think NULL values are messing it up?

  • 1
    Certainly, None input will fail in a cast. You need to conditionally process the calculation. – Vince Mar 2 '19 at 20:52
  • 2
    I am assuming that you are using the Calculate Field tool and have tagged your question accordingly but it would be better if you also make that clear in your question body – PolyGeo Mar 2 '19 at 21:03
  • is this helpful? support.esri.com/en/technical-article/000002287 about 2/3 down is for Pro, with note on NULL – AlexS1 Mar 3 '19 at 16:54
0

You need to replace the Null values with 0s using the field calculator. In python, None (NULL) has a data type of NoneType, which is not the same as a string. This has been confirmed by other threads: https://community.esri.com/thread/37019

And I just confirmed that mattwatt's field calculation in python successfully converts Nulls to 0s. See his comment below.

  • 1
    e.g. int(!FieldName!) if !FieldName! else 0 – mikewatt Dec 19 '19 at 1:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.