datetime to index python code example
Example 1: pandas dataframe set datetime index
df['Datetime'] = pd.to_datetime(df['date'] + ' ' + df['time'])
df = df.set_index('Datetime')
Example 2: how to access dataframe row by datetime index
df.loc['2008-01-01']