Skip to content

Commit feda6a7

Browse files
committed
Add repr flag and length to docs
1 parent a99fa51 commit feda6a7

File tree

3 files changed

+14
-4
lines changed

3 files changed

+14
-4
lines changed

doc/source/api.rst

+2
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

+1-1
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

+11-3
Original file line numberDiff line numberDiff line change
@@ -116,18 +116,26 @@ class IntervalIndex(IntervalMixin, Index):
116116
The indexing behaviors are provisional and may change in
117117
a future version of pandas.
118118
119-
Attributes
119+
Parameters
120120
----------
121-
left, right : array-like (1-dimensional)
122-
Left and right bounds for each interval.
121+
data : array-like (1-dimensional)
122+
Array-like containing Interval objects from which to build the
123+
IntervalIndex
123124
closed : {'left', 'right', 'both', 'neither'}, default 'right'
124125
Whether the intervals are closed on the left-side, right-side, both or
125126
neither.
126127
name : object, optional
127128
Name to be stored in the index.
128129
copy : boolean, default False
129130
Copy the meta-data
131+
132+
Attributes
133+
----------
134+
left
135+
right
136+
closed
130137
mid
138+
length
131139
values
132140
is_non_overlapping_monotonic
133141

0 commit comments

Comments
 (0)