Repository navigation
Closes #5155: Bug: MultiIndex .lookup() attempts illegal dtype cast for tuple keys - #5156
Merged
Merged
Conversation
ajpotts
force-pushed
the
5155_Bug_MultiIndex.lookup
branch
3 times, most recently
from
December 17, 2025 13:32
2303c7b to
11f3fe1
Compare
ajpotts
marked this pull request as ready for review
December 17, 2025 14:17
ajpotts
force-pushed
the
5155_Bug_MultiIndex.lookup
branch
from
January 15, 2026 14:47
11f3fe1 to
a05d13e
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #5156 +/- ##
========================================
Coverage ? 100.00%
========================================
Files ? 4
Lines ? 63
Branches ? 0
========================================
Hits ? 63
Misses ? 0
Partials ? 0 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
drculhane
requested changes
Jan 15, 2026
drculhane
approved these changes
Jan 15, 2026
jaketrookman
approved these changes
Jan 15, 2026
ajpotts
force-pushed
the
5155_Bug_MultiIndex.lookup
branch
from
January 16, 2026 14:39
c32ebc4 to
dd535ad
Compare
ajpotts
enabled auto-merge
January 22, 2026 17:38
ajpotts
disabled auto-merge
January 23, 2026 15:02
ajpotts
enabled auto-merge
January 23, 2026 15:02
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR Description: Improve
Index.lookupandMultiIndex.lookupsemanticsThis pull request refines type-handling, error messaging, and row/column matching
behavior for both
Index.containsandMultiIndex.lookup.It also adds a regression test ensuring that mixed-dtype tuple keys do not
trigger incorrect scalar casting.
The changes improve correctness, readability, and alignment with Pandas semantics.
Summary of Changes
1.
Index.lookupFile:
arkouda/pandas/index.pyboolean
pdarrayof lengthlen(self).TypeErrordescription to reflect that the function expects avalue convertible into an Arkouda array.
akint64).Motivation:
Clarifies semantics and avoids stale / unused imports.
2.
MultiIndex.lookupFile:
arkouda/pandas/index.pyMajor improvements to validation, dtype behavior, and membership logic:
Validation
listortuple.nlevelswith a clearValueError.Two explicit code paths
Per-level arkouda arrays (e.g. list of
pdarray/Strings)Delegated directly to
in1d(self.index, key)for vectorized matching.Scalar tuple keys (e.g.,
(1, "red"))This behavior aligns better with Pandas and eliminates subtle dtype bugs.
3. New Test: Mixed-dtype tuple lookup
File:
tests/pandas/index_test.pyAdded test
test_multiindex_lookup_tuple_mixed_dtypes:(1, "red"):"red"into numeric types.[True, False, False, False]for the provided example.Motivation:
Prevents regressions and captures a real-world bug scenario.
Why This Matters
MultiIndex.lookup.Backward Compatibility
Closes #5155: Bug: MultiIndex .lookup() attempts illegal dtype cast for tuple keys