Categorical Column Profile

Contains class for categorical column profiler.

class dataprofiler.profilers.categorical_column_profile.CategoricalColumn(name: Optional[str], options: Optional[dataprofiler.profilers.profiler_options.CategoricalOptions] = None)

Bases: dataprofiler.profilers.base_column_profilers.BaseColumnProfiler

Categorical column profile subclass of BaseColumnProfiler.

Represents a column int the dataset which is a categorical column.

Initialize column base properties and itself.

Parameters

name (String) – Name of data

type = 'category'
diff(other_profile: dataprofiler.profilers.categorical_column_profile.CategoricalColumn, options: Optional[Dict] = None) Dict

Find the differences for CategoricalColumns.

Parameters

other_profile (CategoricalColumn) – profile to find the difference with

Returns

the CategoricalColumn differences

Return type

dict

report(remove_disabled_flag: bool = False) Dict

Return report.

This is a private abstract method.

Parameters

remove_disabled_flag (boolean) – flag to determine if disabled options should be excluded in the report.

property profile: Dict

Return the profile of the column.

For categorical_count, it will display the top k categories most frequently occurred in descending order.

property categories: List[str]

Return categories.

property categorical_counts: Dict[str, int]

Return counts of each category.

property unique_ratio: float

Return ratio of unique categories to sample_size.

property is_match: bool

Return true if column is categorical.

update(df_series: pandas.core.series.Series) dataprofiler.profilers.categorical_column_profile.CategoricalColumn

Update the column profile.

Parameters

df_series (pandas.core.series.Series) – Data to profile.

Returns

updated CategoricalColumn

Return type

CategoricalColumn

property gini_impurity: Optional[float]

Return Gini Impurity.

Gini Impurity is a way to calculate likelihood of an incorrect classification of a new instance of a random variable.

G = Σ(i=1; J): P(i) * (1 - P(i)), where i is the category classes. We are traversing through categories and calculating with the column

Returns

None or Gini Impurity probability

col_type = None
property unalikeability: Optional[float]

Return Unlikeability.

Unikeability checks for “how often observations differ from one another” Reference: Perry, M. and Kader, G. Variation as Unalikeability. Teaching Statistics, Vol. 27, No. 2 (2005), pp. 58-60.

U = Σ(i=1,n)Σ(j=1,n): (Cij)/(n**2-n) Cij = 1 if i!=j, 0 if i=j

Returns

None or unlikeability probability

name: Optional[str]
sample_size: int
metadata: Dict
times: Dict
thread_safe: bool