Skip to content

Instantly share code, notes, and snippets.

@RenSys
Last active June 22, 2018 12:07
Show Gist options
  • Save RenSys/4e09e5066aa829d029b556c4ca59b575 to your computer and use it in GitHub Desktop.
Save RenSys/4e09e5066aa829d029b556c4ca59b575 to your computer and use it in GitHub Desktop.
Pandas - Datetime Index
d.DataFrame(data={'value_1': value_series_1,
'value_2': value_series_2,
'timestamp': date_time_list},
index=[0, 1, 2, 3, 4])
df.set_index(pd.to_datetime(df.timestamp), inplace=True)
del df['timestamp']
# index column now has time functions e.g.
df.index.year
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment