Skip to content

DOC: Use top-level pd.IntervalArray in doc examples #24475

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
Dec 29, 2018
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
7 changes: 2 additions & 5 deletions pandas/core/arrays/interval.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,8 @@
_VALID_CLOSED = {'left', 'right', 'both', 'neither'}
_interval_shared_docs = {}

# TODO(jschendel) remove constructor key when IntervalArray is public (GH22860)
_shared_docs_kwargs = dict(
klass='IntervalArray',
constructor='pd.core.arrays.IntervalArray',
name=''
)

Expand Down Expand Up @@ -105,7 +103,6 @@
"""


# TODO(jschendel) use a more direct call in Examples when made public (GH22860)
@Appender(_interval_shared_docs['class'] % dict(
klass="IntervalArray",
summary="Pandas array for interval data that are closed on the same side.",
Expand All @@ -119,7 +116,7 @@
A new ``IntervalArray`` can be constructed directly from an array-like of
``Interval`` objects:

>>> pd.core.arrays.IntervalArray([pd.Interval(0, 1), pd.Interval(1, 5)])
>>> pd.IntervalArray([pd.Interval(0, 1), pd.Interval(1, 5)])
IntervalArray([(0, 1], (1, 5]],
closed='right',
dtype='interval[int64]')
Expand Down Expand Up @@ -1035,7 +1032,7 @@ def repeat(self, repeats, axis=None):

Examples
--------
>>> intervals = %(constructor)s.from_tuples([(0, 1), (1, 3), (2, 4)])
>>> intervals = pd.%(klass)s.from_tuples([(0, 1), (1, 3), (2, 4)])
>>> intervals
%(klass)s([(0, 1], (1, 3], (2, 4]],
closed='right',
Expand Down
2 changes: 0 additions & 2 deletions pandas/core/indexes/interval.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,8 @@
_VALID_CLOSED = {'left', 'right', 'both', 'neither'}
_index_doc_kwargs = dict(ibase._index_doc_kwargs)

# TODO(jschendel) remove constructor key when IntervalArray is public (GH22860)
_index_doc_kwargs.update(
dict(klass='IntervalIndex',
constructor='pd.IntervalIndex',
target_klass='IntervalIndex or list of Intervals',
name=textwrap.dedent("""\
name : object, optional
Expand Down