fatf.transparency.data.describe_functions.describe_categorical_array

fatf.transparency.data.describe_functions.describe_categorical_array(array: Union[numpy.ndarray, numpy.void]) → Dict[str, Union[str, int, bool, numpy.ndarray]][source]

Describes a categorical numpy array with basic statistics.

The description output by this function is a dictionary with the following keys:

countinteger

The number of elements in the array.

uniquenumpy.ndarray

The unique values in the array, ordered lexicographically.

unique_countsnumpy.ndarray

The counts of the unique values in the array.

topstring

The most frequent value in the array.

freqinteger

The count of the most frequent value in the array.

is_top_uniqueboolean

Indicates whether the most frequent value (freq) in the array is the only one with that count.

Parameters
arrayUnion[numpy.ndarray, numpy.void]

An array for which a description is desired.

Returns
categorical_descriptionDict[string, Union[string, integer, boolean, numpy.ndarray]]

A dictionary describing the categorical input array.

Raises
IncorrectShapeError

The input array is not 1-dimensinoal.

ValueError

The input array is empty.

Warns
UserWarning

When the input array is not purely textual it needs to be converted to a string type before it can be described.

Examples using fatf.transparency.data.describe_functions.describe_categorical_array