I have a dataframe with info on multiple countries. The data is not very clean and some of the country names have integer values in them. like this China2
or Ukraine18
.
I want to remove the integer values from all entries in the Country
column but am not able to find a robust way to do this. Any help is appreciated
You can use Series.str.replace
:
df['Country'] = df['Country'].str.replace('\d+', '')
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.