We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent e3e198f commit 70b0855Copy full SHA for 70b0855
pandas/core/base.py
@@ -44,6 +44,7 @@
44
from pandas.core.dtypes.generic import (
45
ABCDataFrame,
46
ABCIndex,
47
+ ABCMultiIndex,
48
ABCSeries,
49
)
50
from pandas.core.dtypes.missing import (
@@ -1287,13 +1288,13 @@ def factorize(
1287
1288
if uniques.dtype == np.float16:
1289
uniques = uniques.astype(np.float32)
1290
- if isinstance(self, ABCIndex):
1291
- # preserve e.g. MultiIndex
+ if isinstance(self, ABCMultiIndex):
1292
+ # preserve MultiIndex
1293
uniques = self._constructor(uniques)
1294
else:
1295
from pandas import Index
1296
- uniques = Index(uniques)
1297
+ uniques = Index(uniques, dtype=self.dtype)
1298
return codes, uniques
1299
1300
_shared_docs["searchsorted"] = """
0 commit comments