Skip to content

DOC: Typo(s?) in pandas.DataFrame.isin #43755

Closed
@loucadufault

Description

@loucadufault

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

Location of the documentation

https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.isin.html

Documentation problem

In the last example, the text introducing the code snippet reads:

When values is a Series or DataFrame the index and column must match. Note that ‘falcon’ does not match based on the number of legs in df2.

However, "df2" does not exist in the included code snippet (it is instead called "other").

Additionally, I am not comfortable enough with pandas to assert this, but it seems like the text should incorrectly states that "falcon" does not match, since "falcon" indeed does match for both columns, see the relevant portion of the code snippet:

>>> df.isin(other)
        num_legs  num_wings
falcon      True       True
dog        False      False

Suggested fix for documentation

Text should at least read:

When values is a Series or DataFrame the index and column must match. Note that ‘falcon’ does not match based on the number of legs in other.

or the variable in the code snippet should be renamed to "df2".

Additionally, something may need to be done to address the potential discrepancy in saying that "falcon" does not match.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions