I have an int64 index representing year values that I want to treat as a timestamp index:
df.index
Int64Index([2001,2002,2003], dtype='int64')
How do I convert the index to a datetime timestamp in pandas?
import pandas as pd
df.index = pd.to_datetime(df.index, format='%Y')
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