Skip to content

ENH: Add 'observed' parameter to value_counts #46486

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

Open
vishalsrao opened this issue Mar 23, 2022 · 1 comment
Open

ENH: Add 'observed' parameter to value_counts #46486

vishalsrao opened this issue Mar 23, 2022 · 1 comment
Assignees
Labels
Algos Non-arithmetic algos: value_counts, factorize, sorting, isin, clip, shift, diff Enhancement

Comments

@vishalsrao
Copy link

It could be useful to have 'observed' parameter in value_counts method similar to the one in groupby method.

@vishalsrao vishalsrao added Enhancement Needs Triage Issue that has not been reviewed by a pandas team member labels Mar 23, 2022
@rhshadrach rhshadrach added the Algos Non-arithmetic algos: value_counts, factorize, sorting, isin, clip, shift, diff label Mar 24, 2022
@rhshadrach
Copy link
Member

rhshadrach commented Mar 24, 2022

This came up in #46202.

For Series/DataFrame, is this as simple as reindexing after value_counts and then fillna with 0? For groupby.value_counts, it is not so easy to accomplish. But the current implementation of DataFrameGroupBy.value_counts makes this very easy to add. I'm not sure about SeriesGroupBy.value_counts.

+1, but would like to see it added in both NDFrame and groupby for API consistency.

@rhshadrach rhshadrach removed the Needs Triage Issue that has not been reviewed by a pandas team member label Jun 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Algos Non-arithmetic algos: value_counts, factorize, sorting, isin, clip, shift, diff Enhancement
Projects
None yet
Development

No branches or pull requests

3 participants