How can I find what value in column 1 of my list corresponds to the minimum value in column 2?
|
|
|
|||||||||||
|
|
Edit In my earlier submission, I mistakenly took "corresponds to" as meaning "has the same value as". Here I interpret "corresponds to" as "occupies the same row as".
This variation relies on
Exemplification
The lowest value in column 2 is
Explanation Let's explain what the following does:
First note that Now plug
obtaining
returning `5'. Substituting again,
|
||||
|
|
|
Here's a straightforward way using
You can also use |
|||
|
|
|
Here's another way, stealing @J.M's test list
Remove Or probably faster is
|
|||||||||
|
|
|
Sure. Not sure about "asking" but here's a way to do it. I'll build some data for an example:
And to find the value in the position in column 1 of the minimum of column 2:
|
|||
|
|
|
Beware of the possibility of multiple minima, especially in long lists of discrete elements. I think for a novice J.M.'s solution is the more instructive. I have changed its first element to demonstrate two identical minima:
Finding the position of the minimum/minima:
In order to grab the corresponding values in Col. 1, the "pos" list must be Flattened first:
|
||||
|
|
|
With
variations with
or
or
|
||||
|
|


