@@ -20,28 +20,60 @@ cdef class IntervalMixin(object):
2020 @property
2121 def closed_left (self ):
2222 """
23- Return True if the Interval is closed on the left-side, else False
23+ Check if the interval is closed on the left side.
24+
25+ For the meaning of `closed` and `open` see :class:`~pandas.Interval`.
26+
27+ Returns
28+ -------
29+ bool
30+ ``True`` if the Interval is closed on the left-side, else
31+ ``False``.
2432 """
2533 return self .closed in (' left' , ' both' )
2634
2735 @property
2836 def closed_right (self ):
2937 """
30- Return True if the Interval is closed on the right-side, else False
38+ Check if the interval is closed on the right side.
39+
40+ For the meaning of `closed` and `open` see :class:`~pandas.Interval`.
41+
42+ Returns
43+ -------
44+ bool
45+ ``True`` if the Interval is closed on the left-side, else
46+ ``False``.
3147 """
3248 return self .closed in (' right' , ' both' )
3349
3450 @property
3551 def open_left (self ):
3652 """
37- Return True if the Interval is open on the left-side, else False
53+ Check if the interval is open on the left side.
54+
55+ For the meaning of `closed` and `open` see :class:`~pandas.Interval`.
56+
57+ Returns
58+ -------
59+ bool
60+ ``True`` if the Interval is closed on the left-side, else
61+ ``False``.
3862 """
3963 return not self .closed_left
4064
4165 @property
4266 def open_right (self ):
4367 """
44- Return True if the Interval is open on the right-side, else False
68+ Check if the interval is open on the right side.
69+
70+ For the meaning of `closed` and `open` see :class:`~pandas.Interval`.
71+
72+ Returns
73+ -------
74+ bool
75+ ``True`` if the Interval is closed on the left-side, else
76+ ``False``.
4577 """
4678 return not self .closed_right
4779
@@ -88,12 +120,25 @@ cdef class Interval(IntervalMixin):
88120 closed : {'left', 'right', 'both', 'neither'}, default 'right'
89121 Whether the interval is closed on the left-side, right-side, both or
90122 neither.
123+ closed : {'right', 'left', 'both', 'neither'}, default 'right'
124+ Whether the interval is closed on the left-side, right-side, both or
125+ neither. See the Notes for more detailed explanation.
91126
92127 Notes
93128 -----
94129 The parameters `left` and `right` must be from the same type, you must be
95130 able to compare them and they must satisfy ``left <= right``.
96131
132+ A closed interval (in mathematics denoted by square brackets) contains
133+ its endpoints, i.e. the closed interval ``[0, 5]`` is characterized by the
134+ conditions ``0 <= x <= 5``. This is what ``closed='both'`` stands for.
135+ An open interval (in mathematics denoted by parentheses) does not contain
136+ its endpoints, i.e. the open interval ``(0, 5)`` is characterized by the
137+ conditions ``0 < x < 5``. This is what ``closed='neither'`` stands for.
138+ Intervals can also be half-open or half-closed, i.e. ``[0, 5)`` is
139+ described by ``0 <= x < 5`` (``closed='left'``) and ``(0, 5]`` is
140+ described by ``0 < x <= 5`` (``closed='right'``).
141+
97142 Examples
98143 --------
99144 It is possible to build Intervals of different types, like numeric ones:
@@ -107,12 +152,14 @@ cdef class Interval(IntervalMixin):
107152 >>> 2.5 in iv
108153 True
109154
110- You can test the bounds
155+ You can test the bounds (``closed='right'``, so ``0 < x <= 5``):
111156
112157 >>> 0 in iv
113158 False
114159 >>> 5 in iv
115160 True
161+ >>> 0.0001 in iv
162+ True
116163
117164 Calculate its length
118165
@@ -150,9 +197,10 @@ cdef class Interval(IntervalMixin):
150197 --------
151198 IntervalIndex : An Index of Interval objects that are all closed on the
152199 same side.
153- cut : Bin values into discrete intervals.
154- qcut : Discretize values into equal-sized buckets based on rank or
155- based on sample quantiles.
200+ cut : Convert continuous data into discrete bins (Categorical
201+ of Interval objects).
202+ qcut : Convert continuous data into bins (Categorical of Interval objects)
203+ based on quantiles.
156204 Period : Represents a period of time.
157205 """
158206 _typ = " interval"
0 commit comments