Skip to content

Commit 17489ad

Browse files
authored
TYP: Index._concat (#37671)
1 parent c5d105b commit 17489ad

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

pandas/core/indexes/base.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -4297,13 +4297,13 @@ def append(self, other):
42974297

42984298
return self._concat(to_concat, name)
42994299

4300-
def _concat(self, to_concat, name):
4300+
def _concat(self, to_concat: List["Index"], name: Label) -> "Index":
43014301
"""
43024302
Concatenate multiple Index objects.
43034303
"""
4304-
to_concat = [x._values if isinstance(x, Index) else x for x in to_concat]
4304+
to_concat_vals = [x._values for x in to_concat]
43054305

4306-
result = concat_compat(to_concat)
4306+
result = concat_compat(to_concat_vals)
43074307
return Index(result, name=name)
43084308

43094309
def putmask(self, mask, value):

pandas/core/indexes/category.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -653,7 +653,7 @@ def map(self, mapper):
653653
mapped = self._values.map(mapper)
654654
return Index(mapped, name=self.name)
655655

656-
def _concat(self, to_concat, name):
656+
def _concat(self, to_concat: List["Index"], name: Label) -> "CategoricalIndex":
657657
# if calling index is category, don't check dtype of others
658658
codes = np.concatenate([self._is_dtype_compat(c).codes for c in to_concat])
659659
cat = self._data._from_backing_data(codes)

0 commit comments

Comments
 (0)