Python Replace Non Digit Character In A Dataframe
I have the following dataframe column >>> df2['Age] 1 25 2 35 3 48 y 4 34 yea 5 29 ... I just want to keep the number en replace the value in df2['Age] li
Solution 1:
Use \D+
for replace non numeric to empty string:
df2.Age.replace('\D+','',regex=True,inplace=True)
print (df2)
Age
125235348434529
Post a Comment for "Python Replace Non Digit Character In A Dataframe"