Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions pandas/core/indexes/interval.py
Original file line number Diff line number Diff line change
Expand Up @@ -1061,6 +1061,14 @@ def func(self, other):
name=result_name)
return func

@property
def is_all_dates(self):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

note that we should actually change the default for Index suclasses i think

"""
This is False even when left/right contain datetime-like objects,
as the check is done on the Interval itself
"""
return False

union = _setop('union')
intersection = _setop('intersection')
difference = _setop('difference')
Expand Down
7 changes: 7 additions & 0 deletions pandas/tests/indexes/interval/test_interval.py
Original file line number Diff line number Diff line change
Expand Up @@ -1150,3 +1150,10 @@ def test_set_closed_errors(self, bad_closed):
msg = "invalid option for 'closed': {closed}".format(closed=bad_closed)
with tm.assert_raises_regex(ValueError, msg):
index.set_closed(bad_closed)

def test_is_all_dates(self):
# GH 23576
year_2017 = pd.Interval(pd.Timestamp('2017-01-01 00:00:00'),
pd.Timestamp('2018-01-01 00:00:00'))
year_2017_index = pd.IntervalIndex([year_2017])
assert not year_2017_index.is_all_dates