-
-
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: Fixed pd.unique on array of tuples #16543
Conversation
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.
doc/source/whatsnew/v0.20.2.txt
Outdated
@@ -39,7 +39,7 @@ Bug Fixes | |||
|
|||
- Bug in using ``pathlib.Path`` or ``py.path.local`` objects with io functions (:issue:`16291`) | |||
- Bug in ``DataFrame.update()`` with ``overwrite=False`` and ``NaN values`` (:issue:`15593`) | |||
|
|||
- Bug in :func:`pd.unique` on an array of tuples (:issue:`16519`) |
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.
I think has to be :func:`unique`
?
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.
You're correct.
@@ -929,6 +929,22 @@ def test_unique_index(self): | |||
tm.assert_numpy_array_equal(case.duplicated(), | |||
np.array([False, False, False])) | |||
|
|||
@pytest.mark.parametrize('arr, unique', [ | |||
([(0, 0), (0, 1), (1, 0), (1, 1), (0, 0), (0, 1), (1, 0), (1, 1)], |
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.
also add an example of this in pd.unique
itself.
I think you could back out this change from #16434 |
I with agree @chris-b1 comment, yes that looks right. |
Codecov Report
@@ Coverage Diff @@
## master #16543 +/- ##
=======================================
Coverage 90.79% 90.79%
=======================================
Files 161 161
Lines 51063 51063
=======================================
Hits 46365 46365
Misses 4698 4698
Continue to review full report at Codecov.
|
Codecov Report
@@ Coverage Diff @@
## master #16543 +/- ##
=======================================
Coverage 90.79% 90.79%
=======================================
Files 161 161
Lines 51063 51063
=======================================
Hits 46365 46365
Misses 4698 4698
Continue to review full report at Codecov.
|
Codecov Report
@@ Coverage Diff @@
## master #16543 +/- ##
=======================================
Coverage 90.75% 90.75%
=======================================
Files 161 161
Lines 51074 51074
=======================================
Hits 46353 46353
Misses 4721 4721
Continue to review full report at Codecov.
|
The regression test from #16434 fails if I revert the change. The difference being (Pdb++) values # this is with the fix reverted
array([[1, 'a']], dtype=object)
(Pdb++) lib.list_to_object_array(list([(1, 'a')])) # this is the fix from 16434
array([(1, 'a')], dtype=object) So an array of lists vs. an array of tuples. Is that correct? |
35da5b9
to
8871863
Compare
you may just need to call |
Using |
@TomAugspurger added a commit. should fix up I think. |
@TomAugspurger looks this broke it. ok just revert my commit and merge your changes. This is a very touchy area. I we are doing the right things in the tests, but just tricky to get exactly right. |
@TomAugspurger rebased to remove my commit. |
@jreback are you able to restart appveyor jobs? One of the network tests failed on the first job. |
0a973df
to
eb7c18f
Compare
thanks! |
(cherry picked from commit 9d7afa7)
(cherry picked from commit 9d7afa7)
Closes #16519