# I need to remove only numbers in string values [closed]

How to remove only number values in ArcMap field. I need alphabetic values only. I need a single Python query to remove of those all number values in that field.

• What have you tried? Is the alphabetic value always a single letter at the end of the record? – user2856 Jun 17 at 4:20
• i have tried individually in field calculator using .replace() command. those have always single letters at the some time starting or some time ending – Naresh Jilla Jun 17 at 4:27
• The answer here relies on a pure Python algorithm to do the computation you want. Work on that first, and then try to implement it in Calculate Field. – Vince Jun 17 at 4:31
• This require very Little modification to the answer to your previous question. You should try and add your attempt to your questions to avoid downvotes and closing. – BERA Jun 17 at 5:56
• yeah sure thank you – Naresh Jilla Jun 18 at 6:11

## 1 Answer

In the attribute table, right click on the field you want to modify and select Field Calculator.

Set the parser to Python and tick the box for Show Codeblock.

Enter the following code:

``````def removeDigits(n):
result = ''.join([i for i in n if not i.isdigit()])
return result
``````

Then for the expression, type the following:

``````removeDigits( !HOUSE_NUMBER_N!)
``````

In my example below, I used a field called "LOTPLAN".

• Thank you... Its working... :-) – Naresh Jilla Jun 17 at 4:37
• Great answer. This operation can be simplified without the codeblock, the first line sets result then the second line returns said result making the whole function a one line command: return ''.join([x for x in !HOUSE_NUMBER_N! if not x.isdigit()]) - so the need for a procedural return is simplified to: ''.join([x for x in !HOUSE_NUMBER_N! if not x.isdigit()]) without the codeblock. BUT you have to be sure that the value of !HOUSE_NUMBER_N! is not null (None) or you will get an error 'NoneType' object is not iterable, the user should first select by attributes HOUSE_NUMBER_N is not null – Michael Stimson Jun 17 at 5:32
• ok thank you... – Naresh Jilla Jun 17 at 5:55