CategoricalComponent

class glue.core.component.CategoricalComponent(categorical_data, categories=None, jitter=None, units=None)[source]

Bases: Component

Container for categorical data.

Parameters
categorical_datandarray

The underlying array.

categoriesiterable, optional

List of unique values in the data.

jitterstr, optional

Strategy for jittering the data.

unitsstr, optional

Unit description.

Attributes Summary

categorical

Whether or not the datatype is categorical.

categories

The categories.

codes

The index of the category for each value in the array.

data

The underlying ndarray

labels

The original categorical data.

numeric

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[source]
categories[source]

The categories.

codes[source]

The index of the category for each value in the array.

data[source]
labels[source]

The original categorical data.

numeric[source]

Methods Documentation

jitter(method=None)[source]

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)[source]

Convert into a pandas.Series object.

This will be converted as a dtype=np.object!

Parameters
**kwargs

All kwargs are passed to the Series constructor.

Returns
pandas.Series