title: Pandas DataFrame: How to quickly get first non-NaN value in each row?
body: <pre><code>import pandas
  import numpy
  
  list_of_lines = [['a', 'b', 'c', 'd'],
                   ['a', 'b', 'c', 'd'],
                   ['a', 'b', 'c', 'd'],
                   ['a', 'b', 'c', 'd']]
  
  df1 = pandas.DataFrame(list_of_lines)
  
  df1.ix[2, 0] = numpy.NaN
  df1.ix[2, 1] = numpy.NaN
  </code></pre>
  
  <p>Is there a way to get the first non-NaN value from each row? </p>
  
  <p>The way I am currently doing it is:</p>
  
  <pre><code>df1 = df1.bfill(axis = 1)
  
  my_answer = df1.iloc[:, 1]
  </code></pre>
  
  <p>This gives me:</p>
  
  <pre><code>'a'
  'a'
  'c'
  'a'
  </code></pre>
  
  <p>But it is very slow.</p>
  
  <p>Is there some trick or native way of doing this without having to bfill? My dataframe is 1,500 columns x 10,000 rows and it takes a while to bfill. </p>
  
  <p>There is a similar question <a href="https://stackoverflow.com/questions/31828240/first-non-null-value-per-row-from-a-list-of-pandas-columns/31828559#31828559">here</a> but that answer is slower than my current method. </p>