Would anyone know how to calculate the time delta of the time stamp of the index?
import pandas as pd
import numpy as np
# simulate some data
# ===================================
np.random.seed(0)
dt_rng = pd.date_range('2015-03-02 00:00:00', '2015-07-19 23:00:00', freq='T')
dt_idx = pd.DatetimeIndex(np.random.choice(dt_rng, size=2000, replace=False))
df = pd.DataFrame(np.random.randn(2000), index=dt_idx, columns=['col']).sort_index()
df
Am I on track using df['elapsed_time'] = pd.TimedeltaIndex(df)
at all with this?
This will throw an error:
ValueError: Wrong number of items passed 2000, placement implies 1