-
-
Notifications
You must be signed in to change notification settings - Fork 18.2k
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
ENH: Allow as_index=False on SeriesGroupBy #36507
Comments
I can give this a shot, just not sure where to place the function. Would that be in |
take |
@erfannariman you may want to wait and see if there is general agreement to expand the API as is being proposed here. No problem with putting up a PR before that, but just be aware that the idea as a whole may be opposed. |
Sure, will unassign for now. |
As it is now, there is a bug when having a Series and setting
The index vanishes instead of doing nothing.
Is probably not relevant, if we extend the API. If not, this should be fixed or the docs should be more specific |
@WillAyd @jreback @jorisvandenbossche @jbrockmendel Any thoughts here? |
To the extent that this can be addressed separately, we should do that. i.e. i don't want to have to think about two things at the same time IIRC there was a discussion of deprecating as_index altogether, but im having trouble finding it. |
@jbrockmendel Issue is #35860, I closed upon seeing mild opposition that ultimately included myself. |
I am -0 with maybe a slight -1 on this, only because this keyword isn't very clearly defined and should probably be deprecated instead of invested in further. I assume what you are looking for is just |
Yea I'd still be -1 on investing a lot in this keyword. I'll reopen the other issue |
This is getting in the way of cleaning up groupby (e.g. #46944). The issue is that when
I don't believe our test coverage for this case is very good and I'd guess that this creates inconsistencies in results or even leads to outright errors. Because supporting cc @WillAyd |
Sounds good @rhshadrach - let's run with it |
I also find this behavior more consistent. In pandas 2.0.2, pandas/pandas/core/groupby/generic.py Lines 1940 to 1948 in 027adc5
I see no reason to throw an exception here: Lines 2078 to 2079 in 027adc5
@rhshadrach are you still planning to make this change? |
@anmyachev - in the time since my previous comment,
I would be supportive of adding |
I just stumbled upon this. Trying
Pandas 2.2.0 |
The docs, as you quoted in your comment, say you cannot use |
Yes.
I am not understanding what you are finding confusing, could you expand on this any further? |
Would make the code:
Become:
The change should just amount to calling a function like:
in various methods of SeriesGroupBy (and could be used in DataFrameGroupBy).
This would close #13666 and make #35443 to be just about error reporting for the
axis=1
case.The text was updated successfully, but these errors were encountered: