Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

pandas replace space with underscore in column names

df.rename(columns=lambda x: x.strip().replace(" ", "_"), inplace=True)
 
PREVIOUS NEXT
Tagged: #pandas #replace #space #underscore #column #names
ADD COMMENT
Topic
Name
3+9 =