Skip to content

Commit 7375c73

Browse files
makbigcjreback
authored andcommitted
Add typing annotation to IntervalIndex.intersection (#26870)
1 parent bd09a59 commit 7375c73

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

pandas/core/indexes/interval.py

+10-3
Original file line numberDiff line numberDiff line change
@@ -1140,7 +1140,10 @@ def overlaps(self, other):
11401140

11411141
@Appender(_index_shared_docs['intersection'])
11421142
@SetopCheck(op_name='intersection')
1143-
def intersection(self, other, sort=False):
1143+
def intersection(self,
1144+
other: 'IntervalIndex',
1145+
sort: bool = False
1146+
) -> 'IntervalIndex':
11441147
if self.left.is_unique and self.right.is_unique:
11451148
taken = self._intersection_unique(other)
11461149
elif (other.left.is_unique and other.right.is_unique and
@@ -1157,7 +1160,9 @@ def intersection(self, other, sort=False):
11571160

11581161
return taken
11591162

1160-
def _intersection_unique(self, other):
1163+
def _intersection_unique(self,
1164+
other: 'IntervalIndex'
1165+
) -> 'IntervalIndex':
11611166
"""
11621167
Used when the IntervalIndex does not have any common endpoint,
11631168
no mater left or right.
@@ -1179,7 +1184,9 @@ def _intersection_unique(self, other):
11791184

11801185
return self.take(indexer)
11811186

1182-
def _intersection_non_unique(self, other):
1187+
def _intersection_non_unique(self,
1188+
other: 'IntervalIndex'
1189+
) -> 'IntervalIndex':
11831190
"""
11841191
Used when the IntervalIndex does have some common endpoints,
11851192
on either sides.

0 commit comments

Comments
 (0)