1

I want delete all numeric number in columns ,

Exemple :

  1. ABC *12547 NDFRE12 -> ABC * NDFRE
  2. 12aRE 15P -> aRE P

I want a code with python. I talk about all columns and not only one row.

Using Excel file .xlsx

Column A for example

2 Answers 2

2

Try this for entire dataframe:

df = df.replace(to_replace=r'\d+', value='', regex=True)

For only one column:

df['COLUMN'] = df['COLUMN'].str.replace('\d+', '')
Sign up to request clarification or add additional context in comments.

10 Comments

Wasif Hasan , Thanks ! it's exactly what I want !
If it works for you then please accept it as answer by clicking the big check mark and upvote with the ^ looking button
if I want delete too (*PO, *INV, * ) I need whrite new line ?
Then replace with a newline (\n) instead
df['COLUMN'] = df['COLUMN'].str.replace('*INV', '') ? I can white all in same line ?
|
1

Try with replace

l=['ABC *12547 NDFRE12',
'12aRE 15P -> aRE P']
s = pd.Series(l)
0    ABC *12547 NDFRE12
1    12aRE 15P -> aRE P
s = s.str.replace('\d+','')
0       ABC * NDFRE
1    aRE P -> aRE P
dtype: object

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.