Why Does this DataFrame Modification within Function Change Global Outside Function?
<p>Why does the function below change the global <code>DataFrame</code> named <code>df</code>? Shouldn't it just change a local <code>df</code> within the function, but not the global <code>df</code>?</p>

<pre><code>import pandas as pd

df = pd.DataFrame()

def adding_var_inside_function(df):
    df['value'] = 0

print(df.columns) # Index([], dtype='object')
adding_var_inside_function(df)
print(df.columns) # Index([u'value'], dtype='object')
</code></pre>