Metadata-Version: 2.4
Name: inline-snapshot-pandas
Version: 0.2.0
Summary: pandas integration for inline-snapshot
Project-URL: Documentation, https://github.com/15r10nk/inline-snapshot-pandas#readme
Project-URL: Issues, https://github.com/15r10nk/inline-snapshot-pandas/issues
Project-URL: Source, https://github.com/15r10nk/inline-snapshot-pandas
Author-email: Frank Hoffmann <15r10nk@polarbit.de>
License-Expression: MIT
License-File: LICENSE
Classifier: Development Status :: 4 - Beta
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Programming Language :: Python :: Implementation :: CPython
Classifier: Programming Language :: Python :: Implementation :: PyPy
Requires-Python: >=3.9
Requires-Dist: inline-snapshot>=0.31.0
Requires-Dist: pandas
Description-Content-Type: text/markdown

<!-- -8<- [start:Header] -->


![ci](https://github.com/15r10nk/inline-snapshot-pandas/actions/workflows/ci.yml/badge.svg?branch=main)
[![Docs](https://img.shields.io/badge/docs-mkdocs-green)](https://15r10nk.github.io/inline-snapshot-pandas/)
[![pypi version](https://img.shields.io/pypi/v/inline-snapshot-pandas.svg)](https://pypi.org/project/inline-snapshot-pandas/)
![Python Versions](https://img.shields.io/pypi/pyversions/inline-snapshot-pandas)
![PyPI - Downloads](https://img.shields.io/pypi/dw/inline-snapshot-pandas)
[![coverage](https://img.shields.io/badge/coverage-100%25-blue)](https://15r10nk.github.io/inline-snapshot-pandas/contributing/#coverage)
[![GitHub Sponsors](https://img.shields.io/github/sponsors/15r10nk)](https://github.com/sponsors/15r10nk)

<!-- -8<- [end:Header] -->

## Installation

``` bash
pip install inline-snapshot-pandas
```

## Usage

This packages provides special `assert_(frame|series|index)_equal` implementation which accept a snapshot as second argument.

``` python
from pandas import DataFrame
from inline_snapshot_pandas import assert_frame_equal
from inline_snapshot import snapshot


def test_assert_equal():
    df = DataFrame({"col0": [1, 2]})

    assert_frame_equal(df, snapshot())
```

```bash
pytest --inline-snapshot=create
```

``` python
from pandas import DataFrame
from inline_snapshot_pandas import assert_frame_equal
from inline_snapshot import snapshot


def test_assert_equal():
    df = DataFrame({"col0": [1, 2]})

    assert_frame_equal(
        df,
        snapshot(DataFrame([{"col0": 1}, {"col0": 2}])),
    )
```

Another way to use it is to call `setup()` in `conftest.py`, which replaces the implementation which pandas uses.

``` python
from inline_snapshot_pandas import setup

setup()
```

You can then use implementation from pandas with snapshots.

``` python
from pandas import DataFrame
from pandas.testing import assert_frame_equal
from inline_snapshot import snapshot


def test_assert_equal():
    df = DataFrame({"col0": [1, 2], "col1": [1, 5j], "col3": ["a", "b"]})

    # the second argument can be a snapshot
    assert_frame_equal(
        df,
        snapshot(
            DataFrame(
                [
                    {"col0": 1, "col1": (1 + 0j), "col3": "a"},
                    {"col0": 2, "col1": 5j, "col3": "b"},
                ]
            )
        ),
    )
```

<!-- -8<- [start:Feedback] -->
## Issues

If you encounter any problems, please [report an issue](https://github.com/15r10nk/inline-snapshot-pandas/issues) along with a detailed description.
<!-- -8<- [end:Feedback] -->

## License

Distributed under the terms of the [MIT](http://opensource.org/licenses/MIT) license, "inline-snapshot-pandas" is free and open source software.
