[Solved] How to change column names from numbers to names [closed]


First, move the non-date columns in to the index, then use replace and reset_index:

df = df.set_index('CashFlows')
df = df.rename(columns=lambda x: 'year_'+str(x.year))

solved How to change column names from numbers to names [closed]