title: Column location of last matching value in dataframe row (Python)
body: <p>I have the following dataframe:</p>
  
  <pre><code>df1 = pd.DataFrame({1:[1,2,3,4], 2:[1,2,4,5], 3:[8,1,5,6]})
  
  df1
  Out[7]: 
     1  2  3
  0  1  1  8
  1  2  2  1
  2  3  4  5
  3  4  5  6
  </code></pre>
  
  <p>and I would like to create a new column that will show the distance the last column with a particular value, 2 in this case, from the reference column, 3 in this example, or return an NaN result is no such value is found in a row. Output would be something like:</p>
  
  <pre><code>df1
  Out[11]: 
     1  2  3 dist
  0  1  1  8  NaN
  1  2  2  1    1
  2  3  4  5  NaN
  3  4  5  6  NaN
  </code></pre>
  
  <p>What would be an effective way of accomplishing this task? </p>