I have a Centerlines feature class to which I transferred attributes from an AddressPoints feature class, and now each centerline has the correct street name but also a street number which I don't need since it is a polyline. I'd like to clear those values from the table, without deleting the street name field.
2 Answers
You can use Python and the Field Calculator to strip off the numeric value at the beginning of the string.
Select "Python" at the top, and then enter the following in the Code Block:
def stripDigit(text):
if text.split(' ',1)[0].isdigit():
return text.split(' ',1)[1]
else:
return text
Then, in the bottom-most field, enter the following:
stripDigit(!addressField!)
Replacing addressField
with the name of your address field, retaining the enclosing exclamation points.
You also do not need to overwrite your existing field; you can add a new field and calculate the values, passing in the existing field as the parameter to the stripDigit
function.
-
Excellent, I wouldn't say that was exactly what I expected but this is quicker. Prevents me from doing the attribute transfer again. Thanks! Commented Jan 26, 2016 at 21:12
Edited
To clarify, do you have multiple fields that you are trying to delete OR multiple values concatenated together in one field that you are trying to split apart or extract a certain portion of. If it is the latter, my apologies, but if it is the former, then my answer still applies.
I usually use the Delete Fields tool in the Data Management Tools > Fields toolbox.
http://support.esri.com/en/knowledgebase/techarticles/detail/27336