taschini / pyinterval

PyInterval — Interval arithmetic in Python
http://pyinterval.readthedocs.io
Other
83 stars 25 forks source link

generating an interval from a list of lists #24

Open kgeographer opened 4 years ago

kgeographer commented 4 years ago

I've got pairs of years that look like this timespans = [[1200, 1400], [150, 230]]

and can't see how to generate a multi-component interval looking like this via iteration: interval([150.0, 230.0], [1200.0, 1400.0])

I have tried several things, including these k = interval(t for t in timespans) k = interval(tuple(t) for t in timespans) which return an "Invalid interval component" error

k = interval(interval(t) for t in timespans) results in interval([150.0, 1400.0]), which is not multi-component and won't work for the operations I want

k=interval(timespans[0],timespans[1]) gets the right result, but I can't find a way to generate it from a list

can you help?