Description
The argmin
and argmax
functions require the keepdims
keyword argument, same as min
and max
. However, in NumPy, min
and max
have this keyword argument, but argmin
and argmax
do not. We should confirm whether this keyword argument actually makes sense for these functions, or whether it was just added to these functions by mistake because they are also in the non-arg variants.
The description for keepdims
is as follows:
keepdims : bool
If True , the reduced axes (dimensions) must be included in the result as singleton dimensions, and, accordingly, the result must be compatible with the input array (see Broadcasting ). Otherwise, if False , the reduced axes (dimensions) must not be included in the result. Default: False .
Perhaps the reason NumPy doesn't implement this for the arg*
functions is that they return indices, so maintaining broadcastability is not important. The documentation for max
says (emphasis added):
If this is set to True, the axes which are reduced are left in the result as dimensions with size one. With this option, the result will broadcast correctly against the input array.