Given a simple df:
HeaderA | HeaderB | HeaderC
476 4365 457
Is there a way to rename all columns, for example, to add “X” at the end to all columns?
HeaderAX | HeaderBX | HeaderCX
476 4365 457
I am combining several data frames and want to easily distinguish between columns depending on the data set from which they were derived.
Or is this the only way?
df.rename(columns={'HeaderA': 'HeaderAX'}, inplace=True)
I have over 50 column headers and ten files; therefore, the above approach will take a lot of time.
thank
source
share