a2rl.utils.tokenize#

a2rl.utils.tokenize(df)[source]#

Concats all columns to one.

Parameters:

df (WiDataFrame) – a discretized dataframe.

Return type:

ndarray

Returns:

A sequence whose length equals to the number of rows in the input dataframe. Each element in the sequence is the concatenation of tokens of an input row.

Examples

>>> import a2rl as wi
>>> from a2rl.utils import tokenize
>>>
>>> wi_df = wi.read_csv_dataset(wi.sample_dataset_path("chiller")).trim()
>>> wi_df = wi.DiscreteTokenizer().fit_transform(wi_df)
>>> seq = tokenize(wi_df)

>>> wi_df.shape
(9153, 4)

>>> seq.shape
(9153,)

>>> seq[:5]  
array([61165305280, 44161305280, 59177305281, 32172305280, 59170305280])