Skip to content

Added docs for the change of behavior of isin #39064

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Jan 17, 2021

Conversation

omarafifii
Copy link
Contributor

This is to close issue #38781, I added documentation to explain the change of behavior of the isin function.

@pep8speaks
Copy link

pep8speaks commented Jan 9, 2021

Hello @omarafifii! Thanks for updating this PR. We checked the lines you've touched for PEP 8 issues, and found:

There are currently no PEP 8 issues detected in this Pull Request. Cheers! 🍻

Comment last updated at 2021-01-16 13:11:57 UTC

@omarafifii
Copy link
Contributor Author

I added the docs to the isin in the series.py file. Should I also do the same for the one in frame.py?

@@ -4630,6 +4630,34 @@ def isin(self, values) -> "Series":
4 True
5 False
Name: animal, dtype: bool

New behaviour from pandas v1.2.0 caused some tests to fail because users where unaware of this change.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think that we need an example from before 1.2 in the docstrings. Just a comment that we do no longer match strings containing numbers with integers and an example from the new behavior?

Also pls use versionchanged

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I was not sure if I should add the before part or not. Ok, I will remove it.
What do you mean by use versionchanged?

Copy link
Member

@phofl phofl Jan 9, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

.. versionchanged:: 1.2.0
and comment after this (sphinx notation). You can look through the files for a complete example

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, thanks for the help!


>>>import pandas as pd
pd.Series([0]).isin(['0'])
# 0 False
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What are the hashes for?

Copy link
Contributor Author

@omarafifii omarafifii Jan 9, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It was meant to be a comment, but you are right, it's better if I remove them.
Thanks for the feedback!!

# 0 True
# dtype: bool
pd.Series([1]).isin(['1'])
# 0 True
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah just show the new example (you can add a comment that strings and integers are distinct). Keep the style in-line with the other examples.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok thanks for the feedback, I will fix it.

@jreback jreback added the Docs label Jan 9, 2021
@simonjayhawkins simonjayhawkins added this to the 1.2.1 milestone Jan 11, 2021
@simonjayhawkins
Copy link
Member

we may also want to add an entry in the release notes for 1.2 about this change and also a note in the 1.2.1 release notes (other section) that the release notes for 1.2 are updated.

@@ -4630,6 +4630,17 @@ def isin(self, values) -> "Series":
4 True
5 False
Name: animal, dtype: bool

.. versionchanged:: 1.2.0
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you don't neeed the version added.
Also reword this to.

Strings and integers are distinct and are therefore not comparable

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.
I wanted to ask why are some of the checks failing? Am I doing something wrong?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jreback jreback merged commit d175d21 into pandas-dev:master Jan 17, 2021
@jreback
Copy link
Contributor

jreback commented Jan 17, 2021

thanks @omarafifii and @simonjayhawkins

@jreback
Copy link
Contributor

jreback commented Jan 17, 2021

@meeseeksdev backport 1.2.x

@lumberbot-app
Copy link

lumberbot-app bot commented Jan 17, 2021

Something went wrong ... Please have a look at my logs.

luckyvs1 pushed a commit to luckyvs1/pandas that referenced this pull request Jan 20, 2021
nofarm3 pushed a commit to nofarm3/pandas that referenced this pull request Jan 21, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

DOC: Undocumented change in .isin behavior from 1.1.5 to 1.2.0
5 participants