pydata/pandas — Issue #771: daterange intersection issue
Author: tejrai
Created: 2012-02-09 18:46:40+00:00
State: open

When using the daterange intersection function, we found that the intersection only partially works as follows:

>>> a = pandas.DateRange('11/30/2011','12/31/2011')
>>> a

offset: <1 BusinessDay>, tzinfo: None
[2011-11-30 00:00:00, ..., 2011-12-30 00:00:00]
length: 23

>>> b = pandas.DateRange('12/10/2011','12/20/2011')
>>> b

offset: <1 BusinessDay>, tzinfo: None
[2011-12-12 00:00:00, ..., 2011-12-20 00:00:00]
length: 7

>>> a.intersection(b)

offset: <1 BusinessDay>, tzinfo: None
[2011-12-12 00:00:00, ..., 2011-12-30 00:00:00]
length: 15

The intersection function restricts the output on the left side of the range but does not restrict the output on the right side of the range. Ideally, an intersection function should produce the true overlap between the two dateranges instead of the partial (one-sided) overlap.

Thanks,
Tej