From 0a67f4f351927966ea7b299b62c1046e286623da Mon Sep 17 00:00:00 2001 From: Brock Date: Fri, 6 Nov 2020 10:14:37 -0800 Subject: [PATCH] TYP: Index._concat --- pandas/core/indexes/base.py | 6 +++--- pandas/core/indexes/category.py | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/pandas/core/indexes/base.py b/pandas/core/indexes/base.py index f350e18198057..545d1d834fe2d 100644 --- a/pandas/core/indexes/base.py +++ b/pandas/core/indexes/base.py @@ -4297,13 +4297,13 @@ def append(self, other): return self._concat(to_concat, name) - def _concat(self, to_concat, name): + def _concat(self, to_concat: List["Index"], name: Label) -> "Index": """ Concatenate multiple Index objects. """ - to_concat = [x._values if isinstance(x, Index) else x for x in to_concat] + to_concat_vals = [x._values for x in to_concat] - result = concat_compat(to_concat) + result = concat_compat(to_concat_vals) return Index(result, name=name) def putmask(self, mask, value): diff --git a/pandas/core/indexes/category.py b/pandas/core/indexes/category.py index 525c41bae8b51..8c9ee1f1d8efa 100644 --- a/pandas/core/indexes/category.py +++ b/pandas/core/indexes/category.py @@ -653,7 +653,7 @@ def map(self, mapper): mapped = self._values.map(mapper) return Index(mapped, name=self.name) - def _concat(self, to_concat, name): + def _concat(self, to_concat: List["Index"], name: Label) -> "CategoricalIndex": # if calling index is category, don't check dtype of others codes = np.concatenate([self._is_dtype_compat(c).codes for c in to_concat]) cat = self._data._from_backing_data(codes)