I have following pandas dataframe:
| id | LocTime |ZPos | XPos
datetime |
2017-01-02 00:14:39 |20421902611| 12531245409231| 0 | -6
2017-01-02 00:14:40 |30453291020| 28332479673070| 0 | -2
I want to convert datetime index to column of the data frame.
I tried df.reset_index(level=['datetime'])
but the result does not change.
any idea?
Need assign output back or inplace=True
parameter:
df = df.reset_index()
df.reset_index(inplace=True)
print (df)
datetime id LocalTime ZPosition XPosition
0 2017-01-02 00:14:39 10453190861 1483312478909238 0 -9
1 2017-01-02 00:14:40 10453191020 1483312479673076 0 -8
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With