Answers for "pandas add prefix to some range of columns"

0

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)]
Posted by: Guest on March-01-2022

Code answers related to "pandas add prefix to some range of columns"

Python Answers by Framework

Browse Popular Code Answers by Language