#rough
## Pandas and side effects
A function that operates on a data frame introduces a 'side effect' by operating on a dataframe that is technically outside of the function's scope. While you can return the dataframe after you have made changes, you don't have to. The function takes the reference to the dataframe, makes changes to the 'global' dataframe and those changes are saved. For simplicity, I tend to pass the reference back and forth between function and a return variable so that it's clear that I'm making a change to that object. However, one might expect that the original data frame, referenced by a variable higher up in the script, would still be available, but this is not the case. The old reference now points to the new data frame. To avoid this, create a copy with df.copy(), but be warned that creating lots of dataframe copies may eat up memory.