Skip to content

ENH: add as_index to value_counts and pivot_table #49069

@MarcoGorelli

Description

@MarcoGorelli

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 and pivot_table

Feature Description

as_index argument such that

df.value_counts().reset_index()

and

df.value_counts(as_index=False)

return the same value

The default as_index would still be True, but it could be set as False under an option

Additional Context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    EnhancementNeeds DiscussionRequires discussion from core team before further action

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions