-
-
Notifications
You must be signed in to change notification settings - Fork 18.5k
BUG: Fix MutliIndexed unstack failures at tuple names #30943
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
Conversation
pandas/tests/series/test_reshape.py
Outdated
@@ -0,0 +1,59 @@ | |||
import pytest |
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 did not find test for series.unstack
, so just created one, pls let me know where the tests are stored, then I could move this part into the corresponding file.
Thanks!
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.
See tests/series/test_analytics.py
:
pandas/pandas/tests/series/test_analytics.py
Line 163 in 4e2546d
def test_unstack(self): |
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.
ahh! many thanks! @jschendel
not sure if it is the best place for tests for unstack
since analytics
sounds a bit weird to unstack
, maybe worth a follow-up to move to somewhere else @jreback
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.
yeah don't appear to be many, could create (and move the existing ones from test_analytics) to pandas/tests/series/test_reshaping.py to mirror frame
pandas/tests/series/test_reshape.py
Outdated
@@ -0,0 +1,59 @@ | |||
import pytest |
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.
See tests/series/test_analytics.py
:
pandas/pandas/tests/series/test_analytics.py
Line 163 in 4e2546d
def test_unstack(self): |
doc/source/whatsnew/v1.0.0.rst
Outdated
@@ -1133,6 +1133,7 @@ Reshaping | |||
- Bug in :func:`merge_asof` merging on a tz-aware ``left_index`` and ``right_on`` a tz-aware column (:issue:`29864`) | |||
- Improved error message and docstring in :func:`cut` and :func:`qcut` when `labels=True` (:issue:`13318`) | |||
- Bug in missing `fill_na` parameter to :meth:`DataFrame.unstack` with list of levels (:issue:`30740`) | |||
- Bug in :func:`unstack` can take tuple names in MultiIndexed data (:issue:`19966`) |
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.
:func:`unstack`
doesn't exist, so instead should probably be ":meth:`DataFrame.unstack`
and :meth:`Series.unstack`
"
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! changed!
Hello @charlesdong1991! 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 2020-01-20 20:12:00 UTC |
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 @charlesdong1991 for the PR. will need to move whatsnew to doc/source/whatsnew/v1.1.0.rst once #30907 is merged.
sure! @simonjayhawkins I will keep this in mind and wait for that PR to be merged together with reviews from other maintainers |
@@ -317,6 +317,8 @@ def _unstack_multiple(data, clocs, fill_value=None): | |||
|
|||
index = data.index | |||
|
|||
if clocs in index.names: |
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 a comment here on what is going on
pandas/tests/series/test_reshape.py
Outdated
@@ -0,0 +1,59 @@ | |||
import pytest |
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.
yeah don't appear to be many, could create (and move the existing ones from test_analytics) to pandas/tests/series/test_reshaping.py to mirror frame
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.
if you can do that move, and minor comments; ping on green.
comment added and tests moved, and also rebased ping @jreback |
some followup reviews will be appreciated ^^ |
gentle ping @jreback ^^ thanks 😅 |
thanks @charlesdong1991 very nice! |
black pandas
git diff upstream/master -u -- "*.py" | flake8 --diff