a2rl.WiDataFrame.to_csv_dataset#
- WiDataFrame.to_csv_dataset(path_or_buf, *args, forced_categories=None, compact=False, **kwargs)[source]#
Save this data frame as a
Whatif
dataset.This method has similar signatures to
pandas.DataFrame.to_csv()
, however with some changes.- Parameters:
path_or_buf (
str
|PathLike
[str
]) – Unlikepandas.DataFrame.to_csv()
, this accepts only path name of the output dir.args – passed to
pandas.DataFrame.to_csv()
.kwargs – passed to
pandas.DataFrame.to_csv()
.
- Return type:
See also
Example
Save a
WiDataFrame
to directory/tmp/my-dataset
.>>> from a2rl import WiDataFrame >>> df = WiDataFrame( ... { ... "i": [3, 4, 5], ... "s": [1, 2, 3], ... "j": [4, 5, 6], ... "a": ["x", "y", "z"], ... "k": ["z", "x", "y"], ... "r": [0.5, 1.5, 2.5], ... }, ... states=["s"], ... actions=["a"], ... rewards=["r"], ... ) >>> df i s j a k r 0 3 1 4 x z 0.5 1 4 2 5 y x 1.5 2 5 3 6 z y 2.5 >>> df.to_csv_dataset("/tmp/my-dataset")