Skip to content

Commit 9e54733

Browse files
committed
Add repr flag and length to docs
1 parent dd4ce3c commit 9e54733

File tree

3 files changed

+9
-10
lines changed

3 files changed

+9
-10
lines changed

doc/source/api.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1623,6 +1623,7 @@ IntervalIndex Components
16231623
IntervalIndex.right
16241624
IntervalIndex.mid
16251625
IntervalIndex.closed
1626+
IntervalIndex.length
16261627
IntervalIndex.values
16271628
IntervalIndex.is_non_overlapping_monotonic
16281629

@@ -1995,6 +1996,7 @@ Properties
19951996
Interval.closed_left
19961997
Interval.closed_right
19971998
Interval.left
1999+
Interval.length
19982000
Interval.mid
19992001
Interval.open_left
20002002
Interval.open_right

pandas/_libs/interval.pyx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ cdef class IntervalMixin(object):
6363
return self.right - self.left
6464
except TypeError:
6565
# length not defined for some types, e.g. string
66-
msg = 'cannot compute length between {left} and {right}'
66+
msg = 'cannot compute length between {left!r} and {right!r}'
6767
raise TypeError(msg.format(left=self.left, right=self.right))
6868

6969

pandas/core/indexes/interval.py

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -118,18 +118,14 @@ class IntervalIndex(IntervalMixin, Index):
118118
119119
Attributes
120120
----------
121-
left, right : array-like (1-dimensional)
122-
Left and right bounds for each interval.
123-
closed : {'left', 'right', 'both', 'neither'}, default 'right'
124-
Whether the intervals are closed on the left-side, right-side, both or
125-
neither.
126-
name : object, optional
127-
Name to be stored in the index.
128-
copy : boolean, default False
129-
Copy the meta-data
121+
left
122+
right
123+
closed
130124
mid
125+
length
131126
values
132127
is_non_overlapping_monotonic
128+
name
133129
134130
Methods
135131
-------
@@ -138,6 +134,7 @@ class IntervalIndex(IntervalMixin, Index):
138134
from_breaks
139135
from_intervals
140136
contains
137+
copy
141138
142139
Examples
143140
---------

0 commit comments

Comments
 (0)