@@ -56,7 +56,7 @@ from pandas._libs.tslibs.util cimport (
5656 is_timedelta64_object,
5757)
5858
59- VALID_CLOSED = frozenset ([' both' , ' neither' , ' left' , ' right' ])
59+ VALID_INCLUSIVE = frozenset ([' both' , ' neither' , ' left' , ' right' ])
6060
6161
6262cdef class IntervalMixin:
@@ -85,7 +85,7 @@ cdef class IntervalMixin:
8585 Returns
8686 -------
8787 bool
88- True if the Interval is closed on the left -side.
88+ True if the Interval is closed on the right -side.
8989 """
9090 return self .inclusive in (' right' , ' both' )
9191
@@ -99,7 +99,7 @@ cdef class IntervalMixin:
9999 Returns
100100 -------
101101 bool
102- True if the Interval is closed on the left-side.
102+ True if the Interval is not closed on the left-side.
103103 """
104104 return not self .closed_left
105105
@@ -113,7 +113,7 @@ cdef class IntervalMixin:
113113 Returns
114114 -------
115115 bool
116- True if the Interval is closed on the left -side.
116+ True if the Interval is not closed on the right -side.
117117 """
118118 return not self .closed_right
119119
@@ -188,7 +188,7 @@ cdef class IntervalMixin:
188188 """
189189 return (self .right == self .left) & (self .inclusive != ' both' )
190190
191- def _check_closed_matches (self , other , name = ' other' ):
191+ def _check_inclusive_matches (self , other , name = ' other' ):
192192 """
193193 Check if the inclusive attribute of `other` matches.
194194
@@ -203,7 +203,7 @@ cdef class IntervalMixin:
203203 Raises
204204 ------
205205 ValueError
206- When `other` is not closed exactly the same as self.
206+ When `other` is not inclusive exactly the same as self.
207207 """
208208 if self .inclusive != other.inclusive:
209209 raise ValueError (f" '{name}.inclusive' is {repr(other.inclusive)}, "
@@ -259,14 +259,14 @@ cdef class Interval(IntervalMixin):
259259 .. deprecated:: 1.5.0
260260
261261 inclusive : {'both', 'neither', 'left', 'right'}, default 'both'
262- Whether the interval is closed on the left-side, right-side, both or
262+ Whether the interval is inclusive on the left-side, right-side, both or
263263 neither. See the Notes for more detailed explanation.
264264
265265 .. versionadded:: 1.5.0
266266
267267 See Also
268268 --------
269- IntervalIndex : An Index of Interval objects that are all closed on the
269+ IntervalIndex : An Index of Interval objects that are all inclusive on the
270270 same side.
271271 cut : Convert continuous data into discrete bins (Categorical
272272 of Interval objects).
@@ -279,13 +279,13 @@ cdef class Interval(IntervalMixin):
279279 The parameters `left` and `right` must be from the same type, you must be
280280 able to compare them and they must satisfy ``left <= right``.
281281
282- A closed interval (in mathematics denoted by square brackets) contains
283- its endpoints, i.e. the closed interval ``[0, 5]`` is characterized by the
282+ A inclusive interval (in mathematics denoted by square brackets) contains
283+ its endpoints, i.e. the inclusive interval ``[0, 5]`` is characterized by the
284284 conditions ``0 <= x <= 5``. This is what ``inclusive='both'`` stands for.
285285 An open interval (in mathematics denoted by parentheses) does not contain
286286 its endpoints, i.e. the open interval ``(0, 5)`` is characterized by the
287287 conditions ``0 < x < 5``. This is what ``inclusive='neither'`` stands for.
288- Intervals can also be half-open or half-closed , i.e. ``[0, 5)`` is
288+ Intervals can also be half-open or half-inclusive , i.e. ``[0, 5)`` is
289289 described by ``0 <= x < 5`` (``inclusive='left'``) and ``(0, 5]`` is
290290 described by ``0 < x <= 5`` (``inclusive='right'``).
291291
@@ -352,7 +352,7 @@ cdef class Interval(IntervalMixin):
352352
353353 cdef readonly str inclusive
354354 """
355- Whether the interval is closed on the left-side, right-side, both or
355+ Whether the interval is inclusive on the left-side, right-side, both or
356356 neither.
357357 """
358358
@@ -368,7 +368,7 @@ cdef class Interval(IntervalMixin):
368368 if inclusive is None :
369369 inclusive = " right"
370370
371- if inclusive not in VALID_CLOSED :
371+ if inclusive not in VALID_INCLUSIVE :
372372 raise ValueError (f" invalid option for 'inclusive': {inclusive}" )
373373 if not left <= right:
374374 raise ValueError (" left side of interval must be <= right side" )
@@ -522,7 +522,7 @@ cdef class Interval(IntervalMixin):
522522 """
523523 Check whether two Interval objects overlap.
524524
525- Two intervals overlap if they share a common point, including closed
525+ Two intervals overlap if they share a common point, including inclusive
526526 endpoints. Intervals that only have an open endpoint in common do not
527527 overlap.
528528
@@ -551,7 +551,7 @@ cdef class Interval(IntervalMixin):
551551 >>> i1.overlaps(i3)
552552 False
553553
554- Intervals that share closed endpoints overlap:
554+ Intervals that share inclusive endpoints overlap:
555555
556556 >>> i4 = pd.Interval(0, 1, inclusive='both')
557557 >>> i5 = pd.Interval(1, 2, inclusive='both')
@@ -568,7 +568,7 @@ cdef class Interval(IntervalMixin):
568568 raise TypeError (" `other` must be an Interval, "
569569 f" got {type(other).__name__}" )
570570
571- # equality is okay if both endpoints are closed (overlap at a point)
571+ # equality is okay if both endpoints are inclusive (overlap at a point)
572572 op1 = le if (self .closed_left and other.closed_right) else lt
573573 op2 = le if (other.closed_left and self .closed_right) else lt
574574
@@ -580,16 +580,16 @@ cdef class Interval(IntervalMixin):
580580
581581@ cython.wraparound (False )
582582@ cython.boundscheck (False )
583- def intervals_to_interval_bounds (ndarray intervals , bint validate_closed = True ):
583+ def intervals_to_interval_bounds (ndarray intervals , bint validate_inclusive = True ):
584584 """
585585 Parameters
586586 ----------
587587 intervals : ndarray
588588 Object array of Intervals / nulls.
589589
590- validate_closed : bool, default True
591- Boolean indicating if all intervals must be closed on the same side.
592- Mismatching closed will raise if True, else return None for closed .
590+ validate_inclusive : bool, default True
591+ Boolean indicating if all intervals must be inclusive on the same side.
592+ Mismatching inclusive will raise if True, else return None for inclusive .
593593
594594 Returns
595595 -------
@@ -602,7 +602,7 @@ def intervals_to_interval_bounds(ndarray intervals, bint validate_closed=True):
602602 object inclusive = None , interval
603603 Py_ssize_t i, n = len (intervals)
604604 ndarray left, right
605- bint seen_closed = False
605+ bint seen_inclusive = False
606606
607607 left = np.empty(n, dtype = intervals.dtype)
608608 right = np.empty(n, dtype = intervals.dtype)
@@ -620,13 +620,13 @@ def intervals_to_interval_bounds(ndarray intervals, bint validate_closed=True):
620620
621621 left[i] = interval.left
622622 right[i] = interval.right
623- if not seen_closed :
624- seen_closed = True
623+ if not seen_inclusive :
624+ seen_inclusive = True
625625 inclusive = interval.inclusive
626626 elif inclusive != interval.inclusive:
627627 inclusive = None
628- if validate_closed :
629- raise ValueError (" intervals must all be closed on the same side" )
628+ if validate_inclusive :
629+ raise ValueError (" intervals must all be inclusive on the same side" )
630630
631631 return left, right, inclusive
632632
0 commit comments