|
58 | 58 | indexer_from_factorized,
|
59 | 59 | lexsort_indexer,
|
60 | 60 | )
|
61 |
| -from pandas.core.util.hashing import hash_tuple, hash_tuples |
62 | 61 |
|
63 | 62 | from pandas.io.formats.printing import (
|
64 | 63 | format_object_attrs,
|
@@ -247,6 +246,7 @@ class MultiIndex(Index):
|
247 | 246 | rename = Index.set_names
|
248 | 247 |
|
249 | 248 | _tuples = None
|
| 249 | + sortorder: Optional[int] |
250 | 250 |
|
251 | 251 | # --------------------------------------------------------------------
|
252 | 252 | # Constructors
|
@@ -1430,55 +1430,11 @@ def is_monotonic_decreasing(self) -> bool:
|
1430 | 1430 | # monotonic decreasing if and only if reverse is monotonic increasing
|
1431 | 1431 | return self[::-1].is_monotonic_increasing
|
1432 | 1432 |
|
1433 |
| - @cache_readonly |
1434 |
| - def _have_mixed_levels(self): |
1435 |
| - """ return a boolean list indicated if we have mixed levels """ |
1436 |
| - return ["mixed" in l for l in self._inferred_type_levels] |
1437 |
| - |
1438 | 1433 | @cache_readonly
|
1439 | 1434 | def _inferred_type_levels(self):
|
1440 | 1435 | """ return a list of the inferred types, one for each level """
|
1441 | 1436 | return [i.inferred_type for i in self.levels]
|
1442 | 1437 |
|
1443 |
| - @cache_readonly |
1444 |
| - def _hashed_values(self): |
1445 |
| - """ return a uint64 ndarray of my hashed values """ |
1446 |
| - return hash_tuples(self) |
1447 |
| - |
1448 |
| - def _hashed_indexing_key(self, key): |
1449 |
| - """ |
1450 |
| - validate and return the hash for the provided key |
1451 |
| -
|
1452 |
| - *this is internal for use for the cython routines* |
1453 |
| -
|
1454 |
| - Parameters |
1455 |
| - ---------- |
1456 |
| - key : string or tuple |
1457 |
| -
|
1458 |
| - Returns |
1459 |
| - ------- |
1460 |
| - np.uint64 |
1461 |
| -
|
1462 |
| - Notes |
1463 |
| - ----- |
1464 |
| - we need to stringify if we have mixed levels |
1465 |
| - """ |
1466 |
| - if not isinstance(key, tuple): |
1467 |
| - return hash_tuples(key) |
1468 |
| - |
1469 |
| - if not len(key) == self.nlevels: |
1470 |
| - raise KeyError |
1471 |
| - |
1472 |
| - def f(k, stringify): |
1473 |
| - if stringify and not isinstance(k, str): |
1474 |
| - k = str(k) |
1475 |
| - return k |
1476 |
| - |
1477 |
| - key = tuple( |
1478 |
| - f(k, stringify) for k, stringify in zip(key, self._have_mixed_levels) |
1479 |
| - ) |
1480 |
| - return hash_tuple(key) |
1481 |
| - |
1482 | 1438 | @Appender(Index.duplicated.__doc__)
|
1483 | 1439 | def duplicated(self, keep="first"):
|
1484 | 1440 | shape = map(len, self.levels)
|
@@ -1858,27 +1814,6 @@ def __reduce__(self):
|
1858 | 1814 | )
|
1859 | 1815 | return ibase._new_Index, (type(self), d), None
|
1860 | 1816 |
|
1861 |
| - def __setstate__(self, state): |
1862 |
| - """Necessary for making this object picklable""" |
1863 |
| - if isinstance(state, dict): |
1864 |
| - levels = state.get("levels") |
1865 |
| - codes = state.get("codes") |
1866 |
| - sortorder = state.get("sortorder") |
1867 |
| - names = state.get("names") |
1868 |
| - |
1869 |
| - elif isinstance(state, tuple): |
1870 |
| - |
1871 |
| - nd_state, own_state = state |
1872 |
| - levels, codes, sortorder, names = own_state |
1873 |
| - |
1874 |
| - self._set_levels([Index(x) for x in levels], validate=False) |
1875 |
| - self._set_codes(codes) |
1876 |
| - new_codes = self._verify_integrity() |
1877 |
| - self._set_codes(new_codes) |
1878 |
| - self._set_names(names) |
1879 |
| - self.sortorder = sortorder |
1880 |
| - self._reset_identity() |
1881 |
| - |
1882 | 1817 | # --------------------------------------------------------------------
|
1883 | 1818 |
|
1884 | 1819 | def __getitem__(self, key):
|
|
0 commit comments