Returns the indices of the minimum values along an axis. Parameters ---------- a : array_like Input array. axis : int, optional By default, the index is into the flattened array, otherwise along the specified axis. out : array, optional If pr
(a, axis=None, out=None, *, keepdims=np._NoValue)
| 1358 | |
| 1359 | @array_function_dispatch(_argmin_dispatcher) |
| 1360 | def argmin(a, axis=None, out=None, *, keepdims=np._NoValue): |
| 1361 | """ |
| 1362 | Returns the indices of the minimum values along an axis. |
| 1363 | |
| 1364 | Parameters |
| 1365 | ---------- |
| 1366 | a : array_like |
| 1367 | Input array. |
| 1368 | axis : int, optional |
| 1369 | By default, the index is into the flattened array, otherwise |
| 1370 | along the specified axis. |
| 1371 | out : array, optional |
| 1372 | If provided, the result will be inserted into this array. It should |
| 1373 | be of the appropriate shape and dtype. |
| 1374 | keepdims : bool, optional |
| 1375 | If this is set to True, the axes which are reduced are left |
| 1376 | in the result as dimensions with size one. With this option, |
| 1377 | the result will broadcast correctly against the array. |
| 1378 | |
| 1379 | .. versionadded:: 1.22.0 |
| 1380 | |
| 1381 | Returns |
| 1382 | ------- |
| 1383 | index_array : ndarray of ints |
| 1384 | Array of indices into the array. It has the same shape as `a.shape` |
| 1385 | with the dimension along `axis` removed. If `keepdims` is set to True, |
| 1386 | then the size of `axis` will be 1 with the resulting array having same |
| 1387 | shape as `a.shape`. |
| 1388 | |
| 1389 | See Also |
| 1390 | -------- |
| 1391 | ndarray.argmin, argmax |
| 1392 | amin : The minimum value along a given axis. |
| 1393 | unravel_index : Convert a flat index into an index tuple. |
| 1394 | take_along_axis : Apply ``np.expand_dims(index_array, axis)`` |
| 1395 | from argmin to an array as if by calling min. |
| 1396 | |
| 1397 | Notes |
| 1398 | ----- |
| 1399 | In case of multiple occurrences of the minimum values, the indices |
| 1400 | corresponding to the first occurrence are returned. |
| 1401 | |
| 1402 | Examples |
| 1403 | -------- |
| 1404 | >>> import numpy as np |
| 1405 | >>> a = np.arange(6).reshape(2,3) + 10 |
| 1406 | >>> a |
| 1407 | array([[10, 11, 12], |
| 1408 | [13, 14, 15]]) |
| 1409 | >>> np.argmin(a) |
| 1410 | 0 |
| 1411 | >>> np.argmin(a, axis=0) |
| 1412 | array([0, 0, 0]) |
| 1413 | >>> np.argmin(a, axis=1) |
| 1414 | array([0, 0]) |
| 1415 | |
| 1416 | Indices of the minimum elements of an N-dimensional array: |
| 1417 |
nothing calls this directly
no test coverage detected
searching dependent graphs…