pydata / pydata/xarray

idxmax with multiple dimensions

Open
#10,112 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
Python
Stars
4.2k
Forks
1.4k
Avg merge
2d 15h
Merged PRs (30d)
14

Description

Is your feature request related to a problem?

(I thought we had an issue for this, but can't find it after five minutes of looking, so either we don't or I've done a very bad job searching...)

idxmax (+ idxmin) doesn't accept multiple dimensions, but argmax does.

Describe the solution you'd like

Could we implement idxmax as a wrapper of argmax?

Describe alternatives you've considered

No response

Additional context

Possibly it's just me, but fwiw I find the idxmax & argmax terms very confusing, constantly have to look up which is which... I guess it doesn't help that the description of argmax is "Index or indices of the maximum"...! But I'm not sure there's a good way of making these much better — maybe in a vacuum we could have started with names like label_max & index_max, or argmax & iargmax, but tough to change now.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the implementations of idxmax, idxmin, and argmax, along with their existing tests. Compare how argmax handles multiple dimensions and determine the expected idxmax and idxmin behavior. Done means both methods support the requested multiple-dimension use case with matching test coverage.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
data
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.