This is a fragment of my code in Python. This code perfectly changes dataframe X_real_zeros, but it also changes X, why it happens?
X_real_zeros = X
for column in numeric_cols:
X_real_zeros[column] = X[column].apply(lambda x: 0 if np.isnan(x) == 1 else x)
If I apply something like this:
X['columnii'] = X[column].apply(lambda x: 0 if np.isnan(x) == 1 else x)
It won't change the X[column] in initial dataframe X.