chaimleib / intervaltree

A mutable, self-balancing interval tree. Queries may be by point, by range overlap, or by range containment.
Apache License 2.0
636 stars 108 forks source link

For timespan? #108

Open buhtz opened 3 years ago

buhtz commented 3 years ago

I am not sure what an "Intervall Tree" is and for what this is usefull.

But I wonder if your intervall tree is usefull to for datetime.datetime objects, to find overlapping time spans.

Am I right at this point?

This question is not about how, just if your package is the right answer for this. I will try.

yakovkeselman commented 3 years ago
from dateutil.parser import parse
from intervaltree import IntervalTree
d1 = parse('2020-03-20')
d2 = parse('2020-03-22')
t = IntervalTree()
t[d1:d2] = 0