a2rl.WiDataFrame.sequence#

property WiDataFrame.sequence: ndarray#

Return a 1D Numpy representation of the DataFrame, in row-major order.

Returns:

The sequence of the data frame.

Example

>>> from a2rl import WiDataFrame
>>> df = WiDataFrame(
...     {
...         "sess": [0, 0, 0],
...         "s": [1, 2, 3],
...         "a": ["x", "y", "z"],
...         "r": [0.5, 1.5, 2.5]
...     },
...     states=["s"],
...     actions=["a"],
...     rewards=["r"],
... )

>>> df
   sess  s  a    r
0     0  1  x  0.5
1     0  2  y  1.5
2     0  3  z  2.5

>>> df.sequence
array([0, 1, 'x', 0.5, 0, 2, 'y', 1.5, 0, 3, 'z', 2.5], dtype=object)