Skip to content

DOC: IntervalArray and IntervalIndex minor doc fixes #24780

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 15, 2019
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
1 change: 1 addition & 0 deletions doc/source/api/indexing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,7 @@ IntervalIndex Components
IntervalIndex.get_indexer
IntervalIndex.set_closed
IntervalIndex.overlaps
IntervalIndex.to_tuples

.. _api.multiindex:

Expand Down
14 changes: 8 additions & 6 deletions pandas/core/arrays/interval.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@
closed
mid
length
values
is_non_overlapping_monotonic
%(extra_attributes)s\

Expand Down Expand Up @@ -936,13 +935,16 @@ def mid(self):
# datetime safe version
return self.left + 0.5 * self.length

@property
def is_non_overlapping_monotonic(self):
"""
Return True if the IntervalArray is non-overlapping (no Intervals share
_interval_shared_docs['is_non_overlapping_monotonic'] = """
Return True if the %(klass)s is non-overlapping (no Intervals share
points) and is either monotonic increasing or monotonic decreasing,
else False
"""

@property
@Appender(_interval_shared_docs['is_non_overlapping_monotonic']
% _shared_docs_kwargs)
def is_non_overlapping_monotonic(self):
# must be increasing (e.g., [0, 1), [1, 2), [2, 3), ... )
# or decreasing (e.g., [-1, 0), [-2, -1), [-3, -2), ...)
# we already require left <= right
Expand Down Expand Up @@ -986,7 +988,7 @@ def __array__(self, dtype=None):
Returns NA as a tuple if True, ``(nan, nan)``, or just as the NA
value itself if False, ``nan``.

..versionadded:: 0.23.0
.. versionadded:: 0.23.0

Returns
-------
Expand Down
4 changes: 3 additions & 1 deletion pandas/core/indexes/interval.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ def _new_IntervalIndex(cls, d):
summary="Immutable index of intervals that are closed on the same side.",
name=_index_doc_kwargs['name'],
versionadded="0.20.0",
extra_attributes="is_overlapping\n",
extra_attributes="is_overlapping\nvalues\n",
extra_methods="contains\n",
examples=textwrap.dedent("""\
Examples
Expand Down Expand Up @@ -465,6 +465,8 @@ def is_unique(self):
return self._multiindex.is_unique

@cache_readonly
@Appender(_interval_shared_docs['is_non_overlapping_monotonic']
% _index_doc_kwargs)
def is_non_overlapping_monotonic(self):
return self._data.is_non_overlapping_monotonic

Expand Down