Q:

Removing numbers from strings in a Data frame column

I want to remove numbers from strings in a column, while at the same time keeping numbers that do not have any strings in the same column.
This is how the data looks like;
df=
id       description
1         XG154LU
2         4562689
3         556
4         LE896E
5         65KKL4

This is how i want the output to look like:
id       description
1         XGLU
2         4562689
3         556
4         LEE
5         KKL

I used the code below but when i run it it removes all the entries in the description column and replace it with blanks: 
def clean_text_round1(text):
  text = re.sub('\w*\d\w*', '', text)
  text = re.sub('[‘’“”…]', '', text)
  text = re.sub(r'\n', '', text)
  text = re.sub(r'\r', '', text)
return text

round1 = lambda x: clean_text_round1(x)
df['description'] = df['description'].apply(round1)

A:

Try:
import numpy as np

df['description'] = np.where(df.description.str.contains('^\d+$'), df.description, df.description.str.replace('\d+', ''))

Output:
id       description
1         XGLU
2         4562689
3         556
4         LEE
5         KKL

Logic:
Look if the string contains digits only, if yes, dont do anything and just copy the number as it is. If the string has numbers mixed with string, then replace them with black space '' leaving out only characters without the numbers.

