Skip to content

DOC: Code example doesn't run as shown #63258

@saiwing-yeung

Description

@saiwing-yeung

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

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

Documentation problem

In

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

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

But running it should give

   foo  bar
0    1    4
1    2    5
2  100    6

Suggested fix for documentation

Change as above.

Metadata

Metadata

Assignees

No one assigned

    Labels

    DocsNeeds TriageIssue that has not been reviewed by a pandas team member

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions