Skip to content

TST: Add regression test for GH#55969 datetime.date MultiIndex with np.datetime64#64296

Open
ManasVardhan wants to merge 2 commits intopandas-dev:mainfrom
ManasVardhan:fix/datetime-date-index-np-datetime64
Open

TST: Add regression test for GH#55969 datetime.date MultiIndex with np.datetime64#64296
ManasVardhan wants to merge 2 commits intopandas-dev:mainfrom
ManasVardhan:fix/datetime-date-index-np-datetime64

Conversation

@ManasVardhan
Copy link

This PR adds a regression test for #55969.

The bug was that accessing a MultiIndex with datetime.date at level 0 using np.datetime64 would ignore the second level filter and return all rows matching the date.

The bug has already been fixed on main. This PR adds a test to prevent regression:

  • Verifies that df.loc[(np.datetime64_date, 'A')] correctly returns only rows matching both levels
  • Verifies that df.loc[(np.datetime64_date, 'B')] correctly returns only rows matching both levels
  • Verifies that df.loc[(np.datetime64_date, 'C')] raises KeyError when the combination does not exist

The underlying bug GH#55969 is not yet fixed. Mark the regression test
as xfail so CI passes while the test documents the expected behavior.
@jbrockmendel jbrockmendel added the Needs Tests Unit test(s) needed to prevent regressions label Mar 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Needs Tests Unit test(s) needed to prevent regressions

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants