I have a dataframe which looks like this:
A B C 1 red78 square big235 2 green circle small123 3 blue45 triangle big657
You can also do this via a lambda function with str.isdigit:
lambda
str.isdigit
import pandas as pd df = pd.DataFrame({'Name': ['John5', 'Tom 8', 'Ron 722']}) df['Name'] = df['Name'].map(lambda x: ''.join([i for i in x if i.isdigit()])) # Name # 0 5 # 1 8 # 2 722