title: How to determine the end of a non-NaN series in pandas
body: <p>For a data frame  </p>
  
  <pre><code>df = pd.DataFrame([[np.nan, 3.0, 7.0], [0.0, 5.0, 8.0], [0.0, 0.0, 0.0], [1.0, 3.0, np.nan], [1.0, np.nan, np.nan]],
                    columns=[1, 2, 3], index=pd.date_range('20180101', periods=5))
  </code></pre>
  
  <p>which is </p>
  
  <pre><code>              1    2    3
  2018-01-01  NaN  3.0  7.0
  2018-01-02  0.0  5.0  8.0
  2018-01-03  0.0  0.0  0.0
  2018-01-04  1.0  3.0  NaN
  2018-01-05  1.0  NaN  NaN
  </code></pre>
  
  <p>I would like know when a non-NaN series (column) is over. The resulting data frame should look </p>
  
  <pre><code>                1      2      3
  2018-01-01  False  False  False
  2018-01-02  False  False  False
  2018-01-03  False  False  False
  2018-01-04  False  False   True
  2018-01-05  False   True   True
  </code></pre>
  
  <p>I tried to work with </p>
  
  <pre><code>df.apply(lambda x: x.last_valid_index())
  </code></pre>
  
  <p>which results in </p>
  
  <pre><code>1   2018-01-05
  2   2018-01-04
  3   2018-01-03
  </code></pre>
  
  <p>So far so good. But how to continue? All solutions (also those not containing <code>last_valid_index()</code>) are welcome!</p>