1

I received a shapefile about invasive species. I am using ArcGIS 10.2 for desktop. In Attribute Table, there is column called "Infested_Area" and its got number mix with text, for instance "9100 sq feet". Since I can not run statistic on string I was wondering if it's possible to create a new filed and somehow get rid of the text portion of it and only have number!

  • If there is no decimal point, try this gis.stackexchange.com/questions/118646/… – FelixIP Sep 27 '15 at 3:25
  • This does not look like a duplicate of that particular question to me so I am going to provide an answer. – PolyGeo Sep 27 '15 at 21:53
  • @PolyGeo I saw multiple examples when Qs like this were put on hold, reason OUT OF TOPIC. What makes this one special? – FelixIP Sep 27 '15 at 22:19
  • @FelixIP There is a good argument for this one being off-topic and re-directing to Stack Overflow, and I could easily have called it that way. I didn't, perhaps because I was distracted by the duplicate being pointed at a question that seemed quite distinct. Also, and it's only a personal rule of thumb, I tend to think that Field Calculator questions that do not need a Code Block tend to fall at the on-topic end. – PolyGeo Sep 27 '15 at 22:30
  • @FelixIP Those "multiple examples" (with links) could be worth discussing in Meta GIS SE – PolyGeo Sep 27 '15 at 23:37
1

This is similar to @PolyGeo solution

enter image description here

but will handle different units and unitless entries

!TextField!.split(" ")[0]

Note you cannot run statistics on result, if units are different

1

If your text field (mine is called TextField) always has the same string after the number like below then you can add a number field (mine is called IntegerField).

enter image description here

Then in the Field Calculator set the Parser to Python and use this as the expression to calculate your number field.

int( !TextField!.replace(" sq feet",""))

enter image description here

You should see the text stripped off in the output values for your number field.

enter image description here

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.