Currently, pd.DataFrame does not have a .nunique
method
DataFrames
have various aggregation methods that they share with series
, examples being .sum
, .count
etc. Likewise with DataFrame.groupby
-objects.
In many cases, a .nunique
would be useful as on DataFrame
and DataFrame.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
, with n
columns, you should get back a series
where the index values are the dataframe.columns values, and the series values are the count of unique values, for each column.
Comment From: jreback
you mean like this? https://github.com/pandas-dev/pandas/pull/14376
this will be in 0.20.0 (soon)
Comment From: jreback
duplicate of https://github.com/pandas-dev/pandas/issues/14336
Comment From: topper-123
you mean like this? #14376
Yes, thanks. I only looked through open issues, should have considered closed ones since 19.2 also.