Skip to content

Copy-on-Write Guide - "Previous behavior" output is what would happen post-migration to CoW #57828

Closed
@gah-bo

Description

@gah-bo

Pandas version checks

  • I have checked that the issue still exists on the latest versions of the docs on main here

Location of the documentation

https://pandas.pydata.org/docs/dev/user_guide/copy_on_write.html

Documentation problem

Copy-on-Write (CoW) section of "Previous behavior" states that the behavior before CoW leads to this output:

In [1]: df = pd.DataFrame({"foo": [1, 2, 3], "bar": [4, 5, 6]})

In [2]: subset = df["foo"]

In [3]: subset.iloc[0] = 100

In [4]: df
Out[4]: 
   foo  bar
0    1    4
1    2    5
2    3    6

But that's the behavior that would happen after migrating to CoW

Note: this codeblock seems to be used more than once, each time having this issue

Suggested fix for documentation

Actually show "Previous behavior" on the codeblock

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions