Skip to content

Commit 0606d80

Browse files
committed
CLN: remove obsolete special-casing of MI
1 parent a059c61 commit 0606d80

File tree

1 file changed

+3
-44
lines changed

1 file changed

+3
-44
lines changed

pandas/core/indexes/multi.py

+3-44
Original file line numberDiff line numberDiff line change
@@ -1970,11 +1970,6 @@ def get_indexer(self, target, method=None, limit=None, tolerance=None):
19701970
raise NotImplementedError("method='nearest' not implemented yet "
19711971
'for MultiIndex; see GitHub issue 9365')
19721972
else:
1973-
# we may not compare equally because of hashing if we
1974-
# don't have the same dtypes
1975-
if self._inferred_type_levels != target._inferred_type_levels:
1976-
return Index(self.values).get_indexer(target.values)
1977-
19781973
indexer = self._engine.get_indexer(target)
19791974

19801975
return _ensure_platform_int(indexer)
@@ -2211,17 +2206,6 @@ def _maybe_to_slice(loc):
22112206
''.format(keylen, self.nlevels))
22122207

22132208
if keylen == self.nlevels and self.is_unique:
2214-
2215-
def _maybe_str_to_time_stamp(key, lev):
2216-
if lev.is_all_dates and not isinstance(key, Timestamp):
2217-
try:
2218-
return Timestamp(key, tz=getattr(lev, 'tz', None))
2219-
except Exception:
2220-
pass
2221-
return key
2222-
2223-
key = com._values_from_object(key)
2224-
key = tuple(map(_maybe_str_to_time_stamp, key, self.levels))
22252209
return self._engine.get_loc(key)
22262210

22272211
# -- partial selection or non-unique index
@@ -2354,34 +2338,9 @@ def partial_selection(key, indexer=None):
23542338
return indexer, maybe_droplevels(indexer, ilevels,
23552339
drop_level)
23562340

2357-
if len(key) == self.nlevels:
2358-
2359-
if self.is_unique:
2360-
2361-
# here we have a completely specified key, but are
2362-
# using some partial string matching here
2363-
# GH4758
2364-
all_dates = ((l.is_all_dates and
2365-
not isinstance(k, compat.string_types))
2366-
for k, l in zip(key, self.levels))
2367-
can_index_exactly = any(all_dates)
2368-
if (any(l.is_all_dates
2369-
for k, l in zip(key, self.levels)) and
2370-
not can_index_exactly):
2371-
indexer = self.get_loc(key)
2372-
2373-
# we have a multiple selection here
2374-
if (not isinstance(indexer, slice) or
2375-
indexer.stop - indexer.start != 1):
2376-
return partial_selection(key, indexer)
2377-
2378-
key = tuple(self[indexer].tolist()[0])
2379-
2380-
return (self._engine.get_loc(
2381-
com._values_from_object(key)), None)
2382-
2383-
else:
2384-
return partial_selection(key)
2341+
if len(key) == self.nlevels and self.is_unique:
2342+
# Complete key in unique index -> standard get_loc
2343+
return (self._engine.get_loc(key), None)
23852344
else:
23862345
return partial_selection(key)
23872346
else:

0 commit comments

Comments
 (0)