Find the axis (e.g., rows, columns) indices of a multi-dimensional array associated with the maximum or minimum value. ```python import numpy as np # generate random data x = np.random.random((3, 3, 3, 3)) minidx = x.argmin() # get min index of flattened array maxidx = x.argmax() # get max index of flattened array x.reshape(-1, 1)[minidx] # get min value x.min() x.reshape(-1, 1)[maxidx] # get max value x.max() # get indices for each axis mi = np.unravel_index(minidx, x.shape) ma = np.unravel_index(maxidx, x.shape) # use indices to retrieve values x[mi[0], mi[1], mi[2], mi[3]] x[ma[0], ma[1], ma[2], ma[3]] ``` # References - https://stackoverflow.com/questions/11332205/find-row-or-column-containing-maximum-value-in-numpy-array