title: Get values after idxmin(1)
body: <p>I apply <code>idxmin()</code> to get the index of the minimum absolute value of two columns:</p>
  <pre><code>rep[&quot;OffsetFrom&quot;] = rep[[&quot;OffsetDates&quot;, &quot;OffsetDays&quot;]].abs().idxmin(axis=1).dropna()
  </code></pre>
  <pre><code>    OffsetDates OffsetDays  OffsetFrom
  0       0.0     0.0         OffsetDates
  1       1.0     1.0         OffsetDates
  2       4.0     -3.0        OffsetDays
  3       4.0     -3.0        OffsetDays
  4       6.0     -1.0        OffsetDays
  ... ... ... ...
  1165    0.0     0.0         OffsetDates
  1166    0.0     0.0         OffsetDates
  1167    0.0     0.0         OffsetDates
  1168    0.0     0.0         OffsetDates
  1169    0.0     0.0         OffsetDates
  1170 rows × 3 columns
  </code></pre>
  <p>How do I get a column of the actual values after that?<br />
  PS. This one wouldn't work, since I need to keep the original signs:</p>
  <pre><code>rep[[&quot;OffsetFrom&quot;, &quot;Offset&quot;]] = rep[[&quot;OffsetDates&quot;, &quot;OffsetDays&quot;]].abs().agg(['idxmin','min'], axis=1)
  </code></pre>
  <p>Edit:
  Eventually, I've simply done it with <code>apply</code>:</p>
  <pre><code>def get_abs_min_keep_sign(x):
      return min(x.min(), x.max(), key=abs)
  
  rep[&quot;Offset&quot;] = rep[[&quot;OffsetDates&quot;, &quot;OffsetDays&quot;]].apply(get_abs_min_keep_sign, axis=1)
  </code></pre>
  <p>However, there must be a more elegant approach out there.</p>