Skip to content

Conversation

@jpeacock29
Copy link
Contributor

The "Side effects" section under doc/source/user_guide/categorical.rst (pandas docs) warns that constructing a Series from a Categorical without copy=True allows mutations to propagate back to the original Categorical. This is no longer true as of pandas 3.0, where Copy-on-Write is the default behavior (v3.0.0 release notes).

Under CoW, the Series constructor always behaves as if it produces a copy, so the side effect described in this section cannot occur. Both code examples in the section already produce identical output, confirming the warning is stale.

This PR removes the section entirely.

  • closes #xxxx (Replace xxxx with the GitHub issue number)
  • Tests added and passed if fixing a bug or adding a new feature
  • All code checks passed.
  • Added type annotations to new arguments/methods/functions.
  • Added an entry in the latest doc/source/whatsnew/vX.X.X.rst file if fixing a bug or adding a new feature.
  • I have reviewed and followed all the contribution guidelines
  • If I used AI to develop this pull request, I prompted it to follow AGENTS.md.

The "Side effects" section under `doc/source/user_guide/categorical.rst`
([pandas docs](https://pandas.pydata.org/docs/user_guide/categorical.html))
warns that constructing a `Series` from a `Categorical` without `copy=True`
allows mutations to propagate back to the original `Categorical`. This is no
longer true as of pandas 3.0, where Copy-on-Write is the default behavior
([v3.0.0 release notes](https://pandas.pydata.org/docs/whatsnew/v3.0.0.html)).

Under CoW, the `Series` constructor always behaves as if it produces a copy, so
the side effect described in this section cannot occur. Both code examples in the
section already produce identical output, confirming the warning is stale.

This PR removes the section entirely.
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.

1 participant