I have a pandas dataframe with a lot of timestamps:
| | ti_ms |
|-----+---------------+
| 0 | 1551398400000 |
| 1 | 1551398700000 |
| 2 | 1551399000000 |
| 3 | 1551399300000 |
| 4 | 1551399600000 |
| 5 | 1551399900000 |
| 6 | 1551400200000 |
| 7 | 1551400500000 |
| 8 | 1551400800000 |
The interval is always 3000 miliseconds (5 minutes). I want to check if there is a gap, that means if the interval sometimes is bigger than 3000 miliseconds.
I would solve it like this:
make a new column with the delta between two following rows like this:
df['delta'] = df['ti_ms'] - df['ti_ms'].shift(1)
Then check if there is a df['delta'] != 3000 (except for the first row) --> if No everything is ok.
This seems to me not elegant enough. Is there a better way to look for a gap in the timestamps ?