Lets presume a I have a simple dataframe
And a simple method that does something to the
df1['new column'] = df['some column'] + x
In the above method I modify an entire
with x and save it to a new variable name...inside the method!
However, when I inspect my original dataframe (i.e. df) I see that it also has the new column added to it...
I am aware that the original
I created exists outside of the method. But I would expect that any alterations that occur inside the method, should remain there, unless I save the changes via the
block in my method.
However, I know that I am wrong...the changes also applied within my method, also occur outside of my method. How can this be? Why is this so?