-
-
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: add as_index to value_counts and pivot_table #49069
Comments
Could you try to collect all methods where this would be necessary? |
wait sorry @lucaslarios , still not 100% sure we want this in pandas, I should've added "needs discussion" label - I've added it now |
ok instead of that I will take another issue. |
I think it is a big change the return value of |
true, but the same thing already happens with e.g. |
What is the benefit of adding Comparing with groupby, the
With groupby, you would have to add |
The benefit would be within the larger scope of having an option to make Index opt-in, as it would help fulfill the point of "nobody would get an Index unless they ask for one". This wouldn't be the default pandas behaviour, it'd be behind an option, but it'd mean that someone could opt in to a "I don't want to think about indices" mode |
I see - thanks, I missed the idea of making
I'll even go stronger in saying that, in my opinion, natural row labels is what makes pandas great. As such I feel moving toward "nobody would get an Index unless they ask for one" is moving in the wrong direction. |
Thanks, I've reworded it a bit now - rather than eventually making I also love row labels (I especially like having time series where the index is time, and each column represents a numeric quantity), but I do think there's a case to be made of a "no index by default" mode - I've tried putting some points together here https://hackmd.io/JPWJqwc1SZKz_Zaxe9MZRQ#Why (you've seen the doc before, this is just an updated version, expanding on the "why?" part) |
My understanding is the reason for this issue would be to move toward that, but there is no consensus yet as to whether we should move toward that (e.g. #48880). Is this accurate? |
yup, totally accurate. I'll put it on the agenda for the next call |
Feature Type
Adding new functionality to pandas
Changing existing functionality in pandas
Removing existing functionality in pandas
Problem Description
Some methods (e.g. groupby) have the option to not end up with a column as the index.
This could be added to
value_counts
andpivot_table
Feature Description
as_index
argument such thatand
return the same value
The default
as_index
would still beTrue
, but it could be set asFalse
under an optionAdditional Context
No response
The text was updated successfully, but these errors were encountered: