-
-
Notifications
You must be signed in to change notification settings - Fork 18.6k
BUG: Fix Grouper with multi-level index and frequency (GH7885) #7923
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
need to have a test (you can put in test in the issue almost directly) |
test for level name and by level number |
write unit tests for both using the level number and name then u will know of the code works and/or needs modification to handle level numbers/names. (I think it does) |
Thanks for clarifying. Will do. |
'index' % level) | ||
elif level > 0: | ||
raise ValueError('level > 0 only valid with MultiIndex') | ||
if level not in ax.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.
use ax._get_level_number(level)
validates if it has a good name and a good level
you specify levels like |
|
I get what you are saying. It's just that I see, as it states in the docs, that it is possible to construct a MultiIndex that has level names set to None. In this case, unless I am misunderstanding things, an integer index name will not work. |
of course, an integer when the names are |
My mistake. You're right. |
ok gr8, was puzzled because your tests passed (which should not have) |
a3b30b4
to
ae1200e
Compare
Okay. How does that look? |
@@ -384,7 +384,7 @@ For full docs, see the :ref:`Categorical introduction <categorical>` and the | |||
|
|||
|
|||
|
|||
|
|||
- Bug in ``DataFrame.groupby`` where ``Grouper`` cannot resample using a ``MultiIndex`` level and frequency (:issue:`7885`) |
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.
this actually has nothing to do with resample; just say that Grouper
does not recognize level when frequency is specified
ae1200e
to
38a91d2
Compare
38a91d2
to
5254e52
Compare
I have applied your suggestions. |
@jmorris0x0 thanks, merged in. next time it IS easier! |
close #7885