Jul-24-2019, 07:54 AM
I have a dataframe with the date time as the index and I would like to know how to get the difference in days between the first time stamp and the last timestamp.
i tried the following code:
i tried the following code:
df.index[0]Timestamp('2013-09-10 13:45:36.999997')
df.index[-1]Timestamp('2014-06-18 07:53:05.999996')
diff = pd.Timedelta(df.index[-1] - df.index[0]).seconds #try for secondserror: ValueError: Cannot add integral value to Timestamp without freq.