Skip to content

Bug: Grouping by index and column fails on DataFrame with single index (GH14327) #14428

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 13 commits into from
Oct 15, 2016

Conversation

jonmmease
Copy link
Contributor

This PR is a continuation of #14333. See discussion there for explanation of why this new PR was needed.

@codecov-io
Copy link

codecov-io commented Oct 15, 2016

Current coverage is 85.26% (diff: 96.29%)

Merging #14428 into master will increase coverage by <.01%

@@             master     #14428   diff @@
==========================================
  Files           140        140          
  Lines         50639      50649    +10   
  Methods           0          0          
  Messages          0          0          
  Branches          0          0          
==========================================
+ Hits          43177      43186     +9   
- Misses         7462       7463     +1   
  Partials          0          0          

Powered by Codecov. Last update 286b9b9...9694755

@jonmmease
Copy link
Contributor Author

@jreback it's green

@jreback
Copy link
Contributor

jreback commented Oct 15, 2016

@jmmease can you make the doc-string updates.

@jreback jreback added this to the 0.19.1 milestone Oct 15, 2016
@@ -45,3 +45,4 @@ Bug Fixes

- Bug in ``pd.concat`` where names of the ``keys`` were not propagated to the resulting ``MultiIndex`` (:issue:`14252`)
- Bug in ``MultiIndex.set_levels`` where illegal level values were still set after raising an error (:issue:`13754`)
- Bug in ``df.groupby`` causing an ``AttributeError`` when grouping a single index frame by a column and the index (:issue`14327`)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

say index level.

Index of values to group on
labels : None
Array of locations in level_index
level_index : None
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should match the doc-string of the MultiIndex. ( best to use a shared_doc to avoid repeating doc-strings)

@jonmmease
Copy link
Contributor Author

@jreback Made documentation updates and then rebased to resolve conflict in whatsnew 0.19.1.
Let me know if there's anything else!

@jreback
Copy link
Contributor

jreback commented Oct 15, 2016

lgtm

ping on green

@jonmmease
Copy link
Contributor Author

@jreback green

@jorisvandenbossche jorisvandenbossche merged commit e70252b into pandas-dev:master Oct 15, 2016
@jorisvandenbossche
Copy link
Member

@jmmease Thanks!

tworec pushed a commit to RTBHOUSE/pandas that referenced this pull request Oct 21, 2016
…x (GH14327) (pandas-dev#14428)

Existing logic under "if level is not None:" assumed that index was a MultiIndex.
Now we check and also handle the case where an Index is passed in with a None grouper.
This resolves GH 14327
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.

Grouping by index and column fails on DataFrame with single index
4 participants