Answers for "python pandas remove non-numeric characters from multiple columns"

0

python pandas remove non-numeric characters from multiple columns

# Convert multiple columns to float when they contain non-numeric characters e.g. "R 5 000.00" -> 5000.00
df[['A','B','C','D']] = df[['A','B','C','D']].replace(regex=[r'\D+'], value="").astype(float)
Posted by: Guest on June-23-2021

Code answers related to "python pandas remove non-numeric characters from multiple columns"

Python Answers by Framework

Browse Popular Code Answers by Language