title: Issue with appending to DataFrame if empty
body: <p>I have a data frame that I initialize out of scope of a local method. I would like to do as follows:</p>
  
  <pre><code>def outer_method():
      ... do outer scope stuff here
      df = pd.DataFrame(columns=['A','B','C','D'])
      def recursive_method(arg):
          ... do local stuff here
          # func returns a data frame to be appended to empty data frame
          results_df = func(args)
          df.append(results_df, ignore_index=True)
          return results
  recursive_method(arg)
  return df
  </code></pre>
  
  <p>However, this does NOT work. The <code>df</code> is always empty if I append to it this way. </p>
  
  <p>I found the answer to my problem here: <a href="https://stackoverflow.com/questions/16597265/appending-to-an-empty-data-frame-in-pandas">appending-to-an-empty-data-frame-in-pandas</a>... this works, IF the empty DataFrame object is in scope of the method, but not for my case. As per @DSM's comment "but the append doesn't happen in-place, so you'll have to store the output if you want it:"</p>
  
  <p>IOW, I would need to have something like:</p>
  
  <pre><code>df = df.append(results_df, ignore_index=True)
  </code></pre>
  
  <p>in my local method, but this doesn't help me get access to my outer scope variable df to append to it.</p>
  
  <p>Is there a way to make this happen in place? This works fine with the python <code>extend</code> method for extending the contents of a list object (I realize DataFrames are not lists, but...). Is there an analogous way to do this with a DataFrame object without having to deal with my scoping issues for <code>df</code>?</p>
  
  <p>Btw, the Pandas <code>concat</code> method also works, but I run into the issue of variable scope.</p>