ENH: Add dropna argument to pd.DataFrame.value_counts() #41325
Labels
Algos
Non-arithmetic algos: value_counts, factorize, sorting, isin, clip, shift, diff
API - Consistency
Internal Consistency of API/Behavior
Enhancement
Milestone
Is your feature request related to a problem?
With
pd.Series.value_counts()
it is possible to specifydropna=False
, but that argument does not exist inpd.DataFrame.value_counts()
. As a consequence, all rows that contain at least oneNA
element is dropped when usingdf.value_counts()
.Describe the solution you'd like
It should be possible to call
df.value_counts()
withdropna=False
and get a count for each unique row, including rows that haveNA
s in them.API breaking implications
Like with
pd.Series.value_counts()
the default should bedropna=True
. This will keep consistency between the two implementations, and leave current behavior unchanged.Describe alternatives you've considered
Additional context
The text was updated successfully, but these errors were encountered: