I am working with not-so-small df (1.7GB+ and contains python objects) which I have to do number of calculation and return a list of strings.
However, as mentioned in the documentation of pd.copy, the deep copy is not recursive which means the python objects in my df can potentially be changed in the function.
The problem is, because I have to call the function a lot and due to the size of the df, deep copying each column every time the function is called is not an option.
Is there any tips, tricks, testing methods, or anything that can help?
EDIT: Also after some testing by just reassigning (df_copy=df rather than df=df.copy()), it was found out that applying functions such as groupby or explode to a df does not make changes to the original df while others such as iloc, loc, or sort_values do cause changes.
What causes that?