Metadata-Version: 2.1
Name: pandas2tensorboard
Version: 0.1.1a1
Summary: Pandas DataFrames converted to TensorBoard Format
Home-page: https://pypi.org/project/pandas2tensorboard/
License: MIT
Keywords: tensorboard,pandas,machine learning,visualizer
Author: Anselm Hahn
Author-email: Anselm.Hahn@gmail.com
Maintainer: Anselm Hahn
Maintainer-email: Anselm.Hahn@gmail.com
Requires-Python: >=3.8,<3.10
Classifier: Development Status :: 2 - Pre-Alpha
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Education
Classifier: Intended Audience :: Science/Research
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: MacOS
Classifier: Operating System :: Unix
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: Implementation :: CPython
Classifier: Topic :: Database
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Classifier: Topic :: Scientific/Engineering :: Mathematics
Classifier: Topic :: Scientific/Engineering :: Visualization
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Provides-Extra: all
Provides-Extra: backend
Provides-Extra: modin
Requires-Dist: dask (>=2022.1.1,<2023.0.0); extra == "backend" or extra == "all"
Requires-Dist: intake-omnisci (>=0.1.0,<0.2.0); extra == "backend" or extra == "all"
Requires-Dist: modin (>=0.13.0,<0.14.0); extra == "modin" or extra == "all"
Requires-Dist: pandas (>=1.4.0,<2.0.0)
Requires-Dist: tensorboard (>=2.8.0,<3.0.0)
Requires-Dist: torch (>=1.10.2,<2.0.0)
Project-URL: Documentation, https://github.com/Anselmoo/pandas2tensorboard/
Project-URL: Repository, https://github.com/Anselmoo/pandas2tensorboard/
Description-Content-Type: text/markdown

[![CI - Python Package](https://github.com/Anselmoo/pandas2tensorboard/actions/workflows/python-ci.yml/badge.svg)](https://github.com/Anselmoo/pandas2tensorboard/actions/workflows/python-ci.yml)
[![codecov](https://codecov.io/gh/Anselmoo/pandas2tensorboard/branch/main/graph/badge.svg?token=NqLEIbDdGY)](https://codecov.io/gh/Anselmoo/pandas2tensorboard)
[![PyPI](https://img.shields.io/pypi/v/pandas2tensorboard?logo=PyPi&logoColor=gold)](https://pypi.org/project/pandas2tensorboard/)

# Pandas2TensorBoard

`Pandas2TensorBoard` is a library for transforming the [pandas DataFrame][1]
into the data fomrat of [TensorBoard][2]. `Pandas2TensorBoard` relies on
[torch utilities][3] for the data transformation.

![_](example/example.png)

## Installation

- Regular installation via `pip`:

  ```shell
  pip install pandas2tensorboard
  ```

- With [modin][4] backend for `pandas`

  ```shell
  pip install pandas2tensorboard[modin]
  ```

- With [Dask][5] and [omnisci][6] support for `pandas`

  ```shell
  pip install pandas2tensorboard[backend]
  ```

- With [Dask][5] and [omnisci][6] support for `pandas` and [modin][4] backend for `pandas`

  ```shell
  pip install pandas2tensorboard[all]
  ```

## Usage

Currently the following types of export from `pandas` to `tensorboard` are
supported:

- `pd.DataFrame` -> `scalars`
- `pd.DataFrame` -> `scalars` with timestamp
- `pd.DataFrame` -> `scatter` via hyperparameters

For initializing the `pandas2tensorboard` library, the current syntax of Torch's
[tensorboard.SummaryWriter][7] is used.

### Examples

1. Exporting a regular `pd.DataFrame` to `tensorboard` by removing columns with `str`:

   ```python
   import seaborn as sns

   from pandas2tensorboard import pandas2tensorboard as p2t

   pt = p2t.Pandas2TensorBoard()
   pt.regular_df(
       sns.load_dataset("planets"),
       label="planets",
       remove_nan=True,
       remove_str=True,
   )
   pt.close()
   ```

2. Exporting a `pd.DataFrame` with time column to `tensorboard`:

   ```python
   import seaborn as sns

   from pandas2tensorboard import pandas2tensorboard as p2t

   pt = p2t.Pandas2TensorBoard()
   pt.timeseries_df(
       sns.load_dataset("attention"),
       time="score",
       label="attention",
       remove_nan=True,
       remove_str=True,
       time_convert=True,
   )
   pt.close()
   ```

   > The time column with name `score` is transformed into `float` with timestamp.

3. Exporting a `pd.DataFrame` with hyperparameters to `tensorboard`:

   ```python
   import seaborn as sns

   from pandas2tensorboard import pandas2tensorboard as p2t

   pt = p2t.Pandas2TensorBoard()
   pt.scatter_df(
       sns.load_dataset("anagrams"),
       x_axis="subidr",
       group="anagrams",
       remove_nan=True,
       remove_str=True,
   )
   pt.close()
   ```

   > The `x-axis` corresponds to `hparam_dict`; the dataframe without column
   > `x_axis="subidr"` corresponds to `metric_dict`.

## Contributing

Please feel free to open an [issue][8] or create a [pull request][9]; see also [contributing][10].

## License

Check [MIT][11]

[1]: https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.html
[2]: https://www.tensorflow.org/tensorboard/get_started
[3]: https://pytorch.org/docs/stable/tensorboard.html
[4]: https://modin.readthedocs.io/en/stable/
[5]: https://dask.org/
[6]: https://github.com/Quansight/intake-omnisci
[7]: https://pytorch.org/docs/stable/_modules/torch/utils/tensorboard/writer.html#SummaryWriter
[8]: https://github.com/Anselmoo/pandas2tensorboard/issues
[9]: https://github.com/Anselmoo/pandas2tensorboard/pulls
[10]: https://github.com/Anselmoo/pandas2tensorboard/blob/main/CONTRIBUTING.md
[11]: https://github.com/Anselmoo/pandas2tensorboard/blob/main/LICENSE

