a2rl.WiSeries#
- class a2rl.WiSeries(data=None, states=None, actions=None, rewards=None, **kwargs)[source]#
Bases:
Series
,SarMixin
A
WiSeries
object is apandas.Series
with additional metadata on the expected column names forstates
,actions
, andrewards
(i.e., the sar columns).In addition to the standard
pandas.Series
constructor arguments, aWiSeries
also accepts the following keyword arguments:- Parameters:
states (
Optional
[Collection
[str
]]) – The expected column names for states.actions (
Optional
[Collection
[str
]]) – The expected column names for actions.rewards (
Optional
[Collection
[str
]]) – The expected column names for rewards.
Warning
This class is mainly used internally by
whatif
.By design, the name of a
WiSeries
is equal to zero or one expected sar column name.See also
Examples
Create a new
WiSeries
:>>> import a2rl as wi >>> ser = wi.WiSeries( ... [11, 12, 13], ... name="s0", ... states=["s1", "s2"], ... actions=["a"], ... rewards=["r"], ... ) >>> ser 0 11 1 12 2 13 Name: s0, dtype: int64 >>> ser.sar ['s1', 's2', 'a', 'r']
Inherit sar columns from the source
WiDataFrame
:>>> df = wi.WiDataFrame( ... { ... "s": [0, 1, 2], ... "a": ["x", "y", "z"], ... "r": [0.5, 1.5, 2.5], ... }, ... states=["s"], ... actions=["a"], ... rewards=["r"], ... ) >>> ser = df['a'] >>> ser.sar ['s', 'a', 'r']
Methods
to_csv_dataset
(path_or_buf, *args[, ...])Save this series as a
Whatif
dataset.Attributes
The list of the expected column names of actions.
The list of the expected column names of rewards.
The list of the expected sar column names.
The dictionary of 585 expected sar column names.
The list of the expected column names of states.