I have run a code as follows: data_model = data2
data_model.drop("Sale",axis = 1,inplace = True) This results in the removal of sale column from the data_model dataframe as well as the data2 dataframe. why? does it act like a pointer to data2
I have run a code as follows: data_model = data2
data_model.drop("Sale",axis = 1,inplace = True) This results in the removal of sale column from the data_model dataframe as well as the data2 dataframe. why? does it act like a pointer to data2
 
    
     
    
    Yes, data_model = data2 is just a pointer and does not create a copy, therefore editing one is also editing the other... you have to use this: 
data_model = data2.copy()
And read the docs here
