Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

pandas add prefix to some range of columns

# add prefix to all columns except the first 3
df.columns = ['prefix_' + i if (ix > 2) else i for ix, i in enumerate(df.columns)]
 
PREVIOUS NEXT
Tagged: #pandas #add #prefix #range #columns
ADD COMMENT
Topic
Name
4+3 =