composeml.LabelTimes.select

LabelTimes.select(target)[source]

Selects one of the target variables.

Parameters:target (str) – The name of the target column.
Returns:A label times object that contains a single target.
Return type:lt (LabelTimes)

Examples

Create a label times object that contains multiple target variables.

>>> entity = [0, 0, 1, 1]
>>> labels = [True, False, True, False]
>>> time = ['2020-01-01', '2020-01-02', '2020-01-03', '2020-01-04']
>>> data = {'entity': entity, 'time': time, 'A': labels, 'B': labels}
>>> lt = LabelTimes(data=data, target_entity='entity', target_columns=['A', 'B'])
>>> lt
   entity        time      A      B
0       0  2020-01-01   True   True
1       0  2020-01-02  False  False
2       1  2020-01-03   True   True
3       1  2020-01-04  False  False

Select a single target from the label times.

>>> lt.select('B')
   entity        time      B
0       0  2020-01-01   True
1       0  2020-01-02  False
2       1  2020-01-03   True
3       1  2020-01-04  False