Skip to content

Conversation

@mgarrard
Copy link
Contributor

Summary:
Pandas 3.0 introduced Copy-on-Write (CoW) which makes chained assignment with inplace=True ineffective. The pattern df["col"].replace(..., inplace=True) no longer modifies the original DataFrame because the column selection creates a copy.

Replace the chained inplace=True pattern with explicit assignment:

  • df["col"].replace(..., inplace=True)df["col"] = df["col"].replace(...)

This eliminates the ChainedAssignmentError warning and ensures the DataFrame is actually modified as intended.

Differential Revision: D91187974

@meta-cla meta-cla bot added the CLA Signed Do not delete this pull request or issue due to inactivity. label Jan 22, 2026
@meta-codesync
Copy link

meta-codesync bot commented Jan 22, 2026

@mgarrard has exported this pull request. If you are a Meta employee, you can view the originating Diff in D91187974.

mgarrard added a commit to mgarrard/Ax that referenced this pull request Jan 22, 2026
…k#4799)

Summary:

Pandas 3.0 introduced Copy-on-Write (CoW) which makes chained assignment with `inplace=True` ineffective. The pattern `df["col"].replace(..., inplace=True)` no longer modifies the original DataFrame because the column selection creates a copy.

Replace the chained `inplace=True` pattern with explicit assignment:
- `df["col"].replace(..., inplace=True)` → `df["col"] = df["col"].replace(...)`

This eliminates the `ChainedAssignmentError` warning and ensures the DataFrame is actually modified as intended.

Differential Revision: D91187974
@codecov-commenter
Copy link

codecov-commenter commented Jan 22, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 96.71%. Comparing base (b3ec8b4) to head (b7b726a).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #4799   +/-   ##
=======================================
  Coverage   96.71%   96.71%           
=======================================
  Files         586      586           
  Lines       61306    61306           
=======================================
  Hits        59294    59294           
  Misses       2012     2012           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

mgarrard added a commit to mgarrard/Ax that referenced this pull request Jan 22, 2026
…k#4799)

Summary:

Pandas 3.0 introduced Copy-on-Write (CoW) which makes chained assignment with `inplace=True` ineffective. The pattern `df["col"].replace(..., inplace=True)` no longer modifies the original DataFrame because the column selection creates a copy.

Replace the chained `inplace=True` pattern with explicit assignment:
- `df["col"].replace(..., inplace=True)` → `df["col"] = df["col"].replace(...)`

This eliminates the `ChainedAssignmentError` warning and ensures the DataFrame is actually modified as intended.

Differential Revision: D91187974
mgarrard added a commit to mgarrard/Ax that referenced this pull request Jan 22, 2026
…k#4799)

Summary:

Pandas 3.0 introduced Copy-on-Write (CoW) which makes chained assignment with `inplace=True` ineffective. The pattern `df["col"].replace(..., inplace=True)` no longer modifies the original DataFrame because the column selection creates a copy.

Replace the chained `inplace=True` pattern with explicit assignment:
- `df["col"].replace(..., inplace=True)` → `df["col"] = df["col"].replace(...)`

This eliminates the `ChainedAssignmentError` warning and ensures the DataFrame is actually modified as intended.

Differential Revision: D91187974
…k#4799)

Summary:

Pandas 3.0 introduced Copy-on-Write (CoW) which makes chained assignment with `inplace=True` ineffective. The pattern `df["col"].replace(..., inplace=True)` no longer modifies the original DataFrame because the column selection creates a copy.

Replace the chained `inplace=True` pattern with explicit assignment:
- `df["col"].replace(..., inplace=True)` → `df["col"] = df["col"].replace(...)`

This eliminates the `ChainedAssignmentError` warning and ensures the DataFrame is actually modified as intended.

Differential Revision: D91187974
mgarrard added a commit to mgarrard/Ax that referenced this pull request Jan 26, 2026
…k#4799)

Summary:

Pandas 3.0 introduced Copy-on-Write (CoW) which makes chained assignment with `inplace=True` ineffective. The pattern `df["col"].replace(..., inplace=True)` no longer modifies the original DataFrame because the column selection creates a copy.

Replace the chained `inplace=True` pattern with explicit assignment:
- `df["col"].replace(..., inplace=True)` → `df["col"] = df["col"].replace(...)`

This eliminates the `ChainedAssignmentError` warning and ensures the DataFrame is actually modified as intended.

Differential Revision: D91187974
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed Do not delete this pull request or issue due to inactivity. fb-exported meta-exported

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants