pandas dataframe, copy by value

pandas, python

Solution

All functions in Python are "pass by reference", there is no "pass by value". If you want to make an explicit copy of a pandas object, try `new_frame = frame.copy()`.

Problem

I noticed a bug in my program and the reason it is happening is because it seems that pandas is copying by reference a pandas dataframe instead of by value. I know immutable objects will always be passed by reference but pandas dataframe is not immutable so I do not see why it is passing by reference. Can anyone provide some information? Thanks! Andrew

Original source

Related problems