Skip to content

Conversation

sfc-gh-mvashishtha
Copy link
Contributor

@sfc-gh-mvashishtha sfc-gh-mvashishtha commented Sep 16, 2025

Prior to this commit, calling DataFrame.eval(inplace=False, engine='python') with an assignment would incorrectly update the input dataframe. The root cause was calling copy(deep=None) instead of copy(deep=True). We need to insert new columns to a deep copy of the input dataframe. deep=None is not part of the copy API at all, so we don't need to fix copy() behavior. It happens that deep=None does a deep copy in pandas, which is where we got the deep=None code from.

Resolves #7669

@sfc-gh-mvashishtha sfc-gh-mvashishtha merged commit 98c2207 into modin-project:main Sep 16, 2025
40 checks passed
sfc-gh-jkew pushed a commit that referenced this pull request Sep 19, 2025
Prior to this commit, calling `DataFrame.eval(inplace=False,
engine='python')` with an assignment would incorrectly update the input
dataframe. The root cause was calling `copy(deep=None)` instead of
`copy(deep=True)`. We need to insert new columns to a deep copy of the
input dataframe. `deep=None` is not part of the `copy` API at all, so we
don't need to fix `copy()` behavior. It happens that `deep=None` does a
deep copy in pandas, which is where we got the `deep=None` code from.

Resolves #7669

Signed-off-by: sfc-gh-mvashishtha <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

BUG: DataFrame.eval(engine='python') mutates original dataframe when inplace=False
2 participants