I have a numpy array like below, and I would like to make a new numpy array which has a row that has the minimum value in the last column which is element of xx[:,4].
xx =
[[6.18167195e-02 -3.20902583e-01 7.96803103e+00 5.69096614e+00 6.82949858e+00]
[1.14139479e-02 -2.93352490e-02 5.17031336e+00 2.50552347e+01 1.51127740e+01]
[8.84761009e-03 -2.93352490e-02 1.84764173e+01 2.50552347e+01 2.17658260e+01]
[1.96567549e-03 -2.93352490e-02 8.18878876e+01 2.50552347e+01 5.34715612e+01]
[3.54827629e-01 -1.88511194e+00 4.70728062e-01 1.95791971e-01 3.33260017e-01]
[3.53146766e-01 -1.88511194e+00 9.42210619e-01 1.95791971e-01 5.69001295e-01]
[6.64244146e-02 -3.20902583e-01 1.10815151e+00 5.69096614e+00 3.39955882e+00]
[6.18167195e-02 -3.20902583e-01 7.96803103e+00 5.69096614e+00 6.82949858e+00]
[1.95005819e-02 -1.40482917e-01 2.64188251e+00 1.63546768e+00 2.13867510e+00]
...
...]
I know that we can use np.min(xx[:,4]) to get 3.33260017e-01 in the last column.
However, I need to extract all values in the corresponding row, which will be this
[3.54827629e-01 -1.88511194e+00 4.70728062e-01 1.95791971e-01 3.33260017e-01].
In a multidimensional array, such as xx.shape = (1000,4), how can I get the element locations of the minimum value?
My question is either one of them.
Make a new numpy array only with the row that has the minimum value in the last column.
Delete every rows except the row that has the minimum value in the last column.
xx[xx[:, -1].argmin()]?