eland.DataFrame.nunique#

DataFrame.nunique() Series#

Return cardinality of each field.

Note we can only do this for aggregatable Elasticsearch fields - (in general) numeric and keyword rather than text fields

This method will try and field aggregatable fields if possible if mapping has:

"customer_first_name" : {
  "type" : "text",
  "fields" : {
    "keyword" : {
      "type" : "keyword",
      "ignore_above" : 256
    }
  }
}

we will aggregate customer_first_name columns using customer_first_name.keyword.

TODO - implement remainder of pandas arguments

Returns#

pandas.Series

cardinality of each column

See Also#

pandas.DataFrame.nunique

Examples#

>>> columns = ['category', 'currency', 'customer_birth_date', 'customer_first_name', 'user']
>>> df = ed.DataFrame('http://localhost:9200', 'ecommerce', columns=columns)
>>> df.nunique()
category                6
currency                1
customer_birth_date     0
customer_first_name    46
user                   46
dtype: int64