Add .nunique method to DataFrame and .groupby #15794
Labels
Duplicate Report
Duplicate issue or pull request
Enhancement
Reshaping
Concat, Merge/Join, Stack/Unstack, Explode
Currently, pd.DataFrame does not have a
.nunique
methodDataFrames
have various aggregation methods that they share withseries
, examples being.sum
,.count
etc. Likewise withDataFrame.groupby
-objects.In many cases, a
.nunique
would be useful as onDataFrame
andDataFrame.groupby
-objects, for example when you're trying to assess the diversity of data in a DataFrame.Expected Output
When you're using
DataFrame.nunique
, withn
columns, you should get back aseries
where the index values are the dataframe.columns values, and the series values are the count of unique values, for each column.The text was updated successfully, but these errors were encountered: