Skip to content

Fix idxminmax for interval coordinates#11313

Open
lavaFreak wants to merge 1 commit intopydata:mainfrom
lavaFreak:interval-idxmax-fix
Open

Fix idxminmax for interval coordinates#11313
lavaFreak wants to merge 1 commit intopydata:mainfrom
lavaFreak:interval-idxmax-fix

Conversation

@lavaFreak
Copy link
Copy Markdown

Description

Fix DataArray.idxmax() and DataArray.idxmin() when the reduced dimension uses interval coordinates. _calc_idxminmax() was replacing the coordinate's original pandas index adapter with a raw extension array before the final label lookup, which causes scalar interval selections to fail with TypeError: len() of unsized object.

This keeps pandas extension-backed coordinates on their original adapter for the final lookup, adds a regression test for both idxmax and idxmin, and documents the bug fix in doc/whats-new.rst.

Checklist

AI Disclosure

  • This PR contains AI-generated content.
    • I have tested any AI-generated content in my PR.
    • I take responsibility for any AI-generated content in my PR.
      Tools: Codex

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

.idxmax() fails if coordinates are intervals

1 participant