Reputation: 75
here are the data frame look like
CCD CFO CP3 DHC ERS FRO HDI IHI IPI ODF PAE
0 EGP 40 USD 210 USD
inclu 1500 THB 70 INR 855 EUR
inclu 60 CNY
The first line is the column name, what I want to do is to remove the currency and keep the number and 'inclu'. Calculate the total number of each row.
Upvotes: 1
Views: 321
Reputation: 863301
Use DataFrame.replace
for remove space(s) or uppercase strings to end of value in all columns:
df = df.replace(r'(\s+[A-Z]+)$', '', regex=True)
Upvotes: 1