CategoricalComponent#
- class glue.core.component.CategoricalComponent(categorical_data, categories=None, jitter=None, units=None)#
Bases:
ComponentContainer for categorical data.
- Parameters:
- categorical_data
ndarray The underlying array.
- categoriesiterable, optional
List of unique values in the data.
- jitterstr, optional
Strategy for jittering the data.
- unitsstr, optional
Unit description.
- categorical_data
Attributes Summary
Whether or not the datatype is categorical.
The categories.
The index of the category for each value in the array.
The underlying
ndarrayThe original categorical data.
Whether or not the datatype is numeric.
Methods Summary
jitter([method])Jitter the codes so the density of points can be easily seen in a scatter plot for example.
to_series(**kwargs)Convert into a pandas.Series object.
Attributes Documentation
- categorical#
- categories#
The categories.
- codes#
The index of the category for each value in the array.
- data#
- labels#
The original categorical data.
- numeric#
Methods Documentation
- jitter(method=None)#
Jitter the codes so the density of points can be easily seen in a scatter plot for example.
- Parameters:
- method{None, ‘uniform’}
If None, no jittering is done (or any jittering is undone). If
'uniform', the codes are randomized by a uniformly distributed random variable.
- to_series(**kwargs)#
Convert into a pandas.Series object.
When not explicitly specifying dtype, this will be converted as an np.object for pandas < 3, but default to string (pd.StringDtype) for >= 3!
- Parameters:
- **kwargs
All kwargs are passed to the Series constructor.
- Returns: