-
-
Notifications
You must be signed in to change notification settings - Fork 18.1k
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
BUG: fix isin with Series of tuples values (#16394) #16434
Conversation
…lues = lib.list_to_object_array(list(values))" in the isin() method found in core/algorithms.py Added test for comparing to a list of tuples
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The test looks good, let's wait what Travis says.
Can you add a small entry about this fix in the whatsnew file? This can be in doc/source/whatsnew/v0.20.2.txt
pandas/tests/frame/test_analytics.py
Outdated
df['C'] = list(zip(df['A'], df['B'])) | ||
result = df['C'].isin([(1, 'a')]) | ||
tm.assert_series_equal(result, | ||
Series([True,False,False],name="C")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for PEP8: the indentation does not fully match with the line before (one space more needed), and a space after the comma is needed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry about that, fixed
pandas/tests/frame/test_analytics.py
Outdated
@@ -1201,6 +1201,13 @@ def test_isin_df(self): | |||
expected['B'] = False | |||
tm.assert_frame_equal(result, expected) | |||
|
|||
def test_isin_tuples(self): | |||
df = pd.DataFrame({'A': [1, 2, 3], 'B': ['a', 'b', 'f']}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add the original issue number as a comment on the first line ?
just like # GH16394
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
- Fixed PEP8 formatting issue in test
Added the following to the whatsnew file under Bugs - Resizing:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm, minor doc comment.
doc/source/whatsnew/v0.20.2.txt
Outdated
@@ -80,7 +80,7 @@ Reshaping | |||
^^^^^^^^^ | |||
|
|||
- Bug in ``DataFrame.stack`` with unsorted levels in MultiIndex columns (:issue:`16323`) | |||
|
|||
- Bug in ``isin`` in core/algorithms.py with comparing lists of tuples |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Series.isin(..)
with a list of tuples. add the issue number here as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, think I got the format correct with the latest commit
@jaredsnyder I think you just a couple of lint issues. https://travis-ci.org/pandas-dev/pandas/jobs/234970029 |
Codecov Report
@@ Coverage Diff @@
## master #16434 +/- ##
=======================================
Coverage 90.42% 90.42%
=======================================
Files 161 161
Lines 51023 51023
=======================================
Hits 46138 46138
Misses 4885 4885
Continue to review full report at Codecov.
|
Codecov Report
@@ Coverage Diff @@
## master #16434 +/- ##
==========================================
- Coverage 90.42% 90.42% -0.01%
==========================================
Files 161 161
Lines 51023 51023
==========================================
- Hits 46138 46137 -1
- Misses 4885 4886 +1
Continue to review full report at Codecov.
|
doc/source/whatsnew/v0.20.2.txt
Outdated
@@ -80,7 +80,7 @@ Reshaping | |||
^^^^^^^^^ | |||
|
|||
- Bug in ``DataFrame.stack`` with unsorted levels in MultiIndex columns (:issue:`16323`) | |||
|
|||
- Bug in ``Series.isin(..)`` in core/algorithms.py with a list of tuples (:issue:`16394`) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bug in Series.isin(...)
with a list of tuples. No need to mention internal things.
minor comment. ping on green. |
@jreback addressed your comment |
@jaredsnyder Thanks! |
…-dev#16434) * Swiched out "values = np.array(list(values), dtype='object')" for "values = lib.list_to_object_array(list(values))" in the isin() method found in core/algorithms.py Added test for comparing to a list of tuples (cherry picked from commit e053ee3)
* Swiched out "values = np.array(list(values), dtype='object')" for "values = lib.list_to_object_array(list(values))" in the isin() method found in core/algorithms.py Added test for comparing to a list of tuples (cherry picked from commit e053ee3)
…-dev#16434) * Swiched out "values = np.array(list(values), dtype='object')" for "values = lib.list_to_object_array(list(values))" in the isin() method found in core/algorithms.py Added test for comparing to a list of tuples
Switched out
values = np.array(list(values), dtype='object')
for
values = lib.list_to_object_array(list(values))
in the isin() method found in core/algorithms.py
Added test for comparing to a list of tuples
git diff upstream/master --name-only -- '*.py' | flake8 --diff