Wednesday, 18 April 2018

Removing extra string from text column in Attribute Table to make numeric column from number part using ArcGIS Field Calculator?


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!




Answer



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


No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...