Is it possible to split a time series on it's gaps. For example, suppose we had the following:
rng2011 = pd.date_range('1/1/2011', periods=72, freq='H')
rng2012 = pd.date_range('1/1/2012', periods=72, freq='H')
Y = rng2011.union(rng2012)
Is it possible to look for gaps of a year or more, and split the data frame on them?
I imagine this would go something like:
Y.groupby(Y.map(lambda x: x.year))
Except that this splits on the year date, and I'm interested in specifying an interval gap rather than the year attribute of the row.
The application is I've got trip logs from a gps, but no delineation of when one trip ended and another began. I'd like to split on gaps of ten minutes or longer.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…