title: How to modify a pandas DataFrame in a function so that changes are seen by the caller?
body: <p>I find myself doing repetitive tasks to various <code>[pandas][1]</code> DataFrames, so I made a function to do the processing. How do I modify <code>df</code> in the function <code>process_df(df)</code> so that the caller sees all changes (without assigning a return value)? </p>
  
  <p>A simplified version of the code:</p>
  
  <pre><code>def process_df(df):
      df.columns = map(str.lower, df.columns)
  
  df = pd.DataFrame({'A': [1], 'B': [2]})
  process_df(df)
  print df
  </code></pre>
  
  <blockquote>
  <pre><code>   A  B 
  0  1  2
  </code></pre>
  </blockquote>
  
  <p>EDIT new code:</p>
  
  <pre><code>def process_df(df):
      df = df.loc[:, 'A']
  
  df = pd.DataFrame({'A': [1], 'B': [2]})
  process_df(df)
  print df
  </code></pre>
  
  <blockquote>
  <pre><code>   A  B 
  0  1  2
  </code></pre>
  </blockquote>