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:
count
integerThe number of elements in the array.
unique
numpy.ndarrayThe unique values in the array, ordered lexicographically.
unique_counts
numpy.ndarrayThe counts of the unique values in the array.
top
stringThe most frequent value in the array.
freq
integerThe count of the most frequent value in the array.
is_top_unique
booleanIndicates 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.