title: Advanced Pandas: How to apply NOTNULL in pandas chaining?
body: <p>I was doing some data manipulation with TMDB dataset and encountered the following problem.</p>
  
  <p>Let's say I have a dataframe given below:</p>
  
  <pre><code>import pandas as pd
  import ast
  
  df = pd.DataFrame({'rank': [1,2,3],
                   'belongs': [ "{'id': 1, 'name': 'Toy Story'}",
                                "{'id': 3, 'name': 'Grumpy Old Men'}",
                               np.nan
                              ]})
  
  print(df[df.belongs.notnull()])
  </code></pre>
  
  <p>When I run the commands sequentially, I got the required franchise name:</p>
  
  <pre><code>fran = df['belongs'].copy()
  fran = fran[fran.notnull()]
  fran = fran.apply(ast.literal_eval)
  fran = fran.apply(lambda x: x['name'] if isinstance(x, dict) else np.nan)
  fran = fran[fran.notnull()]
  
  fran
  
  0         Toy Story
  1    Grumpy Old Men
  </code></pre>
  
  <p>How to chain these commands in an one-liner ?</p>
  
  <p>I tried this:</p>
  
  <pre><code>(df['belongs'].copy()
  .apply( lambda x: x[x.notnull()])
  .apply(ast.literal_eval)
  .apply(lambda x: x['name'] if isinstance(x, dict) else np.nan)
  .apply( lambda x: x[x.notnull()])
  )
  </code></pre>
  
  <p>Gives the error:</p>
  
  <pre><code>AttributeError: 'str' object has no attribute 'notnull'
  </code></pre>
  
  <p>I tried changing x to pd.Series(x) but some errors are persistent.</p>
  
  <p><strong>How to chain the given operations?</strong></p>