title: Efficiently reduce Series of lists to one dimensional list of non-null values in Python
body: <p>Is there a better way to approach this problem?</p>
  
  <p><strong>Problem</strong>: reduce pandas series, <em>status</em>, to list <em>l</em> given below;</p>
  
  <pre><code>status = [[], [], [], [], ['200'], [], [], ['200']]
  l = ['200', '200']
  </code></pre>
  
  <p>Here is how I solved it;</p>
  
  <pre><code>def flatten(x):
     if len(x)&gt;0:
         return x[0]
     else: 
         return ""
  
  status = status[status.apply(lambda x: flatten(x)) != ""]
  l = [i for row in status.iloc[:] for i in row]
  </code></pre>