8000 BUG: Fix Grouper with multi-level index and frequency (GH7885) by jmorris0x0 · Pull Request #7923 · pandas-dev/pandas · GitHub
[go: up one dir, main page]

Skip to content

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

Merged
merged 1 commit into from
Sep 7, 2014

Conversation

jmorris0x0
Copy link
Contributor

close #7885

@jreback
Copy link
Contributor
jreback commented Aug 4, 2014

need to have a test (you can put in test in the issue almost directly)

@jreback
Copy link
Contributor
jreback commented Aug 4, 2014

test for level name and by level number

@jreback jreback added this to the 0.15.0 milestone Aug 4, 2014
@jreback
Copy link
Contributor
jreback commented Aug 4, 2014

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)

@jmorris0x0
Copy link
Contributor Author

Thanks for clarifying. Will do.

8000
'index' % level)
elif level > 0:
raise ValueError('level > 0 only valid with MultiIndex')
if level not in ax.names:
Copy link
Contributor

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

@jreback
Copy link
Contributor
jreback commented Aug 6, 2014

you specify levels like level=1 (e.g. an integer)

@jreback
Copy link
Contributor
jreback commented Aug 6, 2014

ilevel_0 is ONLY for .query and doesn't apply here

@jmorris0x0
Copy link
Contributor Author

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.

@jreback
Copy link
Contributor
jreback commented Aug 6, 2014

of course, an integer when the names are None is a simply the level. Can you clarify what you mean?

@jmorris0x0
Copy link
Contributor Author

My mistake. You're right.

@jreback
Copy link
Contributor
jreback commented Aug 6, 2014

ok gr8, was puzzled because your tests passed (which should not have)

@jmorris0x0 jmorris0x0 force-pushed the Fix-GH7885 branch 8 times, most recently from a3b30b4 to ae1200e Compare August 25, 2014 08:59
@jmorris0x0
Copy link
Contributor Author

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`)
Copy link
Contributor

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

@jmorris0x0
Copy link
Contributor Author

I have applied your suggestions.

@jreback jreback merged commit 5254e52 into pandas-dev:master Sep 7, 2014
@jreback
Copy link
Contributor
jreback commented Sep 7, 2014

@jmorris0x0 thanks, merged in.

next time it IS easier!

@jmorris0x0 jmorris0x0 deleted the Fix-GH7885 branch September 8, 2014 04:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

BUG: using pd.Grouper with a multi-level index and specifying level (and freq) buggy
2 participants
0