CategoricalComponent

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

Bases: glue.core.component.Component

Container for categorical data.

Parameters
  • categorical_data – The underlying numpy.ndarray

  • categories – List of unique values in the data

Jitter

Strategy for jittering the data

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 numpy.ndarray

labels

The original categorical data.

numeric

Whether or not the datatype is numeric

Methods Summary

jitter(self[, method])

Jitter the codes so the density of points can be easily seen in a scatter plot for example.

to_series(self, \*\*kwargs)

Convert into a pandas.Series object.

Attributes Documentation

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 numpy.ndarray

labels

The original categorical data.

numeric

Whether or not the datatype is numeric

Methods Documentation

jitter(self, 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, not jittering is done (or any jittering is undone). If 'uniform', the codes are randomized by a uniformly distributed random variable.

to_series(self, **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