Reputation: 827
I have a pandas dataframe that when exported to csv looks like this:
VAL1 VAL2
10/2/2014 3.0 2.0
10/3/2014 5.0 4.0
I want it to look like this though:
Date VAL1 VAL2
1 10/2/2014 3.0 2.0
2 10/3/2014 5.0 4.0
Is there any way of doing this?
Upvotes: 1
Views: 144
Reputation: 37930
Call reset_index()
. Something like:
data_frame.reset_index(inplace=True)
You may also need to rename()
to change the columns if Date
isn't the name of your column.
Upvotes: 2