Skip to content

Commit 94095c7

Browse files
authored
Added docs for the change of behavior of isin
This is to close issue pandas-dev#38781
1 parent 8fe3dc6 commit 94095c7

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

pandas/core/series.py

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4630,6 +4630,34 @@ def isin(self, values) -> "Series":
46304630
4 True
46314631
5 False
46324632
Name: animal, dtype: bool
4633+
4634+
New behaviour from pandas v1.2.0 caused some tests to fail because users where unaware of this change.
4635+
4636+
Before v1.2.0:
4637+
4638+
>>>import pandas as pd
4639+
pd.Series([0]).isin(['0'])
4640+
# 0 True
4641+
# dtype: bool
4642+
pd.Series([1]).isin(['1'])
4643+
# 0 True
4644+
# dtype: bool
4645+
pd.Series([1.1]).isin(['1.1'])
4646+
# 0 True
4647+
# dtype: bool
4648+
4649+
From v1.2.0
4650+
4651+
>>>import pandas as pd
4652+
pd.Series([0]).isin(['0'])
4653+
# 0 False
4654+
# dtype: bool
4655+
pd.Series([1]).isin(['1'])
4656+
# 0 False
4657+
# dtype: bool
4658+
pd.Series([1.1]).isin(['1.1'])
4659+
# 0 False
4660+
# dtype: bool
46334661
"""
46344662
result = algorithms.isin(self._values, values)
46354663
return self._constructor(result, index=self.index).__finalize__(

0 commit comments

Comments
 (0)