[Numpy-discussion] `keepdims=True` for argmin/argmx and C-API `PyArray_ArgMaxWithKeepdims`

Sebastian Berg sebastian at sipsolutions.net
Wed Jun 30 21:23:48 EDT 2021


Hi all,

The PR https://github.com/numpy/numpy/pull/19211 proposes to extend
argmin and argmax with a `keepdims=False` keyword-only argument.

This is a standard argument in NumPy, so it is a small API addition.

The PR  also proposes to add:

* `PyArray_ArgMinWithKeepdims`
* `PyArray_ArgMaxWithKeepdims`

in the C-API.  We have barely extended the C-API in a very long time,
so if anyone has concerns, we could pull that out again [1].


Otherwise, this should go in soon, and we will have `keepdims` for both
of those functions in the next release :).

Cheers,

Sebastian



[1] I do not see this is much of a maintenance concern, since the
original function is just a one-line wrapper of the new one.

The API is fairly large and it probably is not used much. So it doesn't
feel important to add to me.  Overally, I just don't have a preference.



More information about the NumPy-Discussion mailing list