Skip to content

daterange intersection issue #771

@tejrai

Description

@tejrai

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
<class 'pandas.core.daterange.DateRange'>
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
<class 'pandas.core.daterange.DateRange'>
offset: <1 BusinessDay>, tzinfo: None
[2011-12-12 00:00:00, ..., 2011-12-20 00:00:00]
length: 7

a.intersection(b)
<class 'pandas.core.daterange.DateRange'>
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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions