DOC: Typo(s?) in pandas.DataFrame.isin
See original GitHub issue- 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.
Issue Analytics
- State:
- Created 2 years ago
- Comments:10 (10 by maintainers)
@Varun270 Just follow the “contributing” instructions to the letter. Yes, there is a bit of a learning curve…
I suggest that you change your change slightly. You say “Note that ‘falcon’ does not match based on the number of legs in other.” But in fact it does match.
I would change to:
other = pd.DataFrame({'num_legs': [8, 3], 'num_wings': [0, 2]},index=['spider', 'falcon'])
Then you will indeed get the falcon not matching:
you can make a new branch - I recommend the first 3 chapters of this book for getting familiar with the git workflow