-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
BUG: Using agg with groupy, as_index=False still returning group variable as index #25114
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
Codecov Report
@@ Coverage Diff @@
## master #25114 +/- ##
=======================================
Coverage 92.37% 92.37%
=======================================
Files 166 166
Lines 52415 52415
=======================================
Hits 48418 48418
Misses 3997 3997
Continue to review full report at Codecov.
|
Codecov Report
@@ Coverage Diff @@
## master #25114 +/- ##
==========================================
- Coverage 91.9% 91.89% -0.01%
==========================================
Files 175 175
Lines 52485 52485
==========================================
- Hits 48234 48230 -4
- Misses 4251 4255 +4
Continue to review full report at Codecov.
|
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.
needs test & a whatnew entry
Test and whatsnew entry added |
doc/source/whatsnew/v0.25.0.rst
Outdated
@@ -170,7 +170,7 @@ Plotting | |||
Groupby/Resample/Rolling | |||
^^^^^^^^^^^^^^^^^^^^^^^^ | |||
|
|||
- | |||
- Bug in :method:'agg' when pqssing a list in the method agg on a Groupby with attibute as_index set as False, returned a DataFrame with the Groupby key as an index, now return the Groupby key as a column. |
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 make this much simpler, I am not sure what you are fixing here. add the issue number
|
||
|
||
def test_not_as_index_agg_list(): | ||
|
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.
add the issue number. parameterize on as_index=[True,False]
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.
like
@pytest.mark.parametize('as_index', [True, False]);
def test_agg_with_as_index(as_index):
....
Thanks for the feedback and comments, I updated the PR accordingly. |
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.
pls search for similar issues in the tracker. I am pretty sure this is actually a duplicate of 1 or more issues. We would also want to replicate those test cases here.
doc/source/whatsnew/v0.25.0.rst
Outdated
@@ -172,7 +172,7 @@ Plotting | |||
Groupby/Resample/Rolling | |||
^^^^^^^^^^^^^^^^^^^^^^^^ | |||
|
|||
- | |||
- Fixed bug in GroupBy when using as_index=False (issue:`25011`) |
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.
Bug in ::meth:`pandas.core.groupby.GroupBy.aggwhen passing
as_index=False``, returning an additional column.
|
||
|
||
def test_not_as_index_agg_list(): | ||
|
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.
like
@pytest.mark.parametize('as_index', [True, False]);
def test_agg_with_as_index(as_index):
....
can you merge master |
@HubertKl can you merge master and fix up conflicts? |
Closing as stale but would certainly like this. Let us know if you'd like to pick it back up @HubertKl ! |
git diff upstream/master -u -- "*.py" | flake8 --diff
This is supposed to solve issue #25011