Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

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)
 
PREVIOUS NEXT
Tagged: #python #pandas #remove #characters #multiple #columns
ADD COMMENT
Topic
Name
5+8 =