title: Best practice for passing Pandas DataFrame to functions
body: <p>I am currently working with a few DataFrames and want to make my code modular. That entails passing DataFrames to functions. I am aware of the mutable nature of DataFrames and some of the 'gotchas' when passing mutable instances to functions. Is there a best practice for DataFrames to the functions? Should I make a copy within the function and then pass it back? Or should I just make changes to df within the function and return None?</p>
  <p>Is option 1 or 2 better? Below is basic code to convey the idea:</p>
  <p>Option 1:</p>
  <pre><code>def test(df):
      df['col1'] = df['col1']+1
      return None
  
  test(df)
  </code></pre>
  <p>Option 2:</p>
  <pre><code>def test(main_df):
      df = main_df.copy()
      df['col1'] = df['col1']+1
      return df 
  
  main_df = test(main_df)
  </code></pre>