Reputation: 405
I want to apply a anonymous function (using .apply()
) like lambda x: x + 1
on indexes of dataframes (not on the columns) how can I do it?
Upvotes: 1
Views: 275
Reputation: 210872
One way would be:
df.set_index(df.index + 1)
another:
df.assign(index=lambda x: x.index+1).set_index('index')
Upvotes: 3