pandera


Namepandera JSON
Version 0.25.0 PyPI version JSON
download
home_pageNone
SummaryA light-weight and flexible data validation and testing tool for statistical data objects.
upload_time2025-07-08 19:20:22
maintainerNone
docs_urlNone
authorNone
requires_python>=3.9
licenseMIT License Copyright (c) 2018 Niels Bantilan Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
keywords pandas validation data-structures
VCS
bugtrack_url
requirements pip packaging typing_extensions hypothesis pyyaml typing_inspect frictionless pyarrow pydantic scipy pandas-stubs pyspark polars modin protobuf geopandas shapely fastapi black numpy pandas isort joblib mypy pylint pytest pytest-cov pytest-xdist pytest-asyncio pytz xdoctest nox uv setuptools ibis-framework uvicorn python-multipart duckdb sphinx sphinx-design sphinx-autodoc-typehints sphinx-copybutton recommonmark myst-nb twine asv pre_commit dask distributed ibis-framework furo sphinx-docsearch grpcio ray typeguard types-click types-pytz types-pyyaml types-requests types-setuptools
Travis-CI No Travis.
coveralls test coverage
            <br>
<div align="center"><a href="https://www.union.ai/pandera"><img src="docs/source/_static/pandera-banner.png" width="400"></a></div>

<h1 align="center">
  The Open-source Framework for Validating DataFrame-like Objects
</h1>

<p align="center">
  📊 🔎 ✅
</p>

<p align="center">
  <i>Data validation for scientists, engineers, and analysts seeking correctness.</i>
</p>

<br>


[![CI Build](https://img.shields.io/github/actions/workflow/status/unionai-oss/pandera/ci-tests.yml?branch=main&label=tests&style=for-the-badge)](https://github.com/unionai-oss/pandera/actions/workflows/ci-tests.yml?query=branch%3Amain)
[![Documentation Status](https://readthedocs.org/projects/pandera/badge/?version=stable&style=for-the-badge)](https://pandera.readthedocs.io/en/stable/?badge=stable)
[![PyPI version shields.io](https://img.shields.io/pypi/v/pandera.svg?style=for-the-badge)](https://pypi.org/project/pandera/)
[![PyPI license](https://img.shields.io/pypi/l/pandera.svg?style=for-the-badge)](https://pypi.python.org/pypi/)
[![pyOpenSci](https://go.union.ai/pandera-pyopensci-badge)](https://github.com/pyOpenSci/software-review/issues/12)
[![Project Status: Active – The project has reached a stable, usable state and is being actively developed.](https://img.shields.io/badge/repo%20status-Active-Green?style=for-the-badge)](https://www.repostatus.org/#active)
[![Documentation Status](https://readthedocs.org/projects/pandera/badge/?version=latest&style=for-the-badge)](https://pandera.readthedocs.io/en/latest/?badge=latest)
[![codecov](https://img.shields.io/codecov/c/github/unionai-oss/pandera?style=for-the-badge)](https://codecov.io/gh/unionai-oss/pandera)
[![PyPI pyversions](https://img.shields.io/pypi/pyversions/pandera.svg?style=for-the-badge)](https://pypi.python.org/pypi/pandera/)
[![DOI](https://img.shields.io/badge/DOI-10.5281/zenodo.3385265-blue?style=for-the-badge)](https://doi.org/10.5281/zenodo.3385265)
[![asv](http://img.shields.io/badge/benchmarked%20by-asv-green.svg?style=for-the-badge)](https://pandera-dev.github.io/pandera-asv-logs/)
[![Monthly Downloads](https://img.shields.io/pypi/dm/pandera?style=for-the-badge&color=blue)](https://pepy.tech/project/pandera)
[![Total Downloads](https://img.shields.io/pepy/dt/pandera?style=for-the-badge&color=blue)](https://pepy.tech/project/pandera)
[![Conda Downloads](https://img.shields.io/conda/dn/conda-forge/pandera?style=for-the-badge)](https://anaconda.org/conda-forge/pandera)
[![Slack](https://img.shields.io/badge/Slack-4A154B?logo=slack&logoColor=fff&style=for-the-badge)](https://flyte-org.slack.com/archives/C08FDTY2X3L)

Pandera is a [Union.ai](https://union.ai/blog-post/pandera-joins-union-ai) open
source project that provides a flexible and expressive API for performing data
validation on dataframe-like objects. The goal of Pandera is to make data
processing pipelines more readable and robust with statistically typed
dataframes.

## Install

Pandera supports [multiple dataframe libraries](https://pandera.readthedocs.io/en/stable/supported_libraries.html), including [pandas](http://pandas.pydata.org), [polars](https://docs.pola.rs/), [pyspark](https://spark.apache.org/docs/latest/api/python/index.html), and more. To validate `pandas` DataFrames, install Pandera with the `pandas` extra:

**With `pip`:**

```
pip install 'pandera[pandas]'
```

**With `uv`:**

```
uv pip install 'pandera[pandas]'
```

**With `conda`:**

```
conda install -c conda-forge pandera-pandas
```

## Get started

First, create a dataframe:

```python
import pandas as pd
import pandera.pandas as pa

# data to validate
df = pd.DataFrame({
    "column1": [1, 2, 3],
    "column2": [1.1, 1.2, 1.3],
    "column3": ["a", "b", "c"],
})
```

Validate the data using the object-based API:

```python
# define a schema
schema = pa.DataFrameSchema({
    "column1": pa.Column(int, pa.Check.ge(0)),
    "column2": pa.Column(float, pa.Check.lt(10)),
    "column3": pa.Column(
        str,
        [
            pa.Check.isin([*"abc"]),
            pa.Check(lambda series: series.str.len() == 1),
        ]
    ),
})

print(schema.validate(df))
#    column1  column2 column3
# 0        1      1.1       a
# 1        2      1.2       b
# 2        3      1.3       c
```

Or validate the data using the class-based API:

```python
# define a schema
class Schema(pa.DataFrameModel):
    column1: int = pa.Field(ge=0)
    column2: float = pa.Field(lt=10)
    column3: str = pa.Field(isin=[*"abc"])

    @pa.check("column3")
    def custom_check(cls, series: pd.Series) -> pd.Series:
        return series.str.len() == 1

print(Schema.validate(df))
#    column1  column2 column3
# 0        1      1.1       a
# 1        2      1.2       b
# 2        3      1.3       c
```


> [!WARNING]
> Pandera `v0.24.0` introduces the `pandera.pandas` module, which is now the
> (highly) recommended way of defining `DataFrameSchema`s and `DataFrameModel`s
> for `pandas` data structures like `DataFrame`s. Defining a dataframe schema from
> the top-level `pandera` module will produce a `FutureWarning`:
>
> ```python
> import pandera as pa
>
> schema = pa.DataFrameSchema({"col": pa.Column(str)})
> ```
>
> Update your import to:
>
> ```python
> import pandera.pandas as pa
> ```
>
> And all of the rest of your pandera code should work. Using the top-level
> `pandera` module to access `DataFrameSchema` and the other pandera classes
> or functions will be deprecated in a future version


## Next steps

See the [official documentation](https://pandera.readthedocs.io) to learn more.

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "pandera",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.9",
    "maintainer_email": null,
    "keywords": "pandas, validation, data-structures",
    "author": null,
    "author_email": "Niels Bantilan <niels.bantilan@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/13/c1/02f78cd18cd32a009405c847dcf430a97d1a8c162f6e8872acae928c8f20/pandera-0.25.0.tar.gz",
    "platform": null,
    "description": "<br>\n<div align=\"center\"><a href=\"https://www.union.ai/pandera\"><img src=\"docs/source/_static/pandera-banner.png\" width=\"400\"></a></div>\n\n<h1 align=\"center\">\n  The Open-source Framework for Validating DataFrame-like Objects\n</h1>\n\n<p align=\"center\">\n  \ud83d\udcca \ud83d\udd0e \u2705\n</p>\n\n<p align=\"center\">\n  <i>Data validation for scientists, engineers, and analysts seeking correctness.</i>\n</p>\n\n<br>\n\n\n[![CI Build](https://img.shields.io/github/actions/workflow/status/unionai-oss/pandera/ci-tests.yml?branch=main&label=tests&style=for-the-badge)](https://github.com/unionai-oss/pandera/actions/workflows/ci-tests.yml?query=branch%3Amain)\n[![Documentation Status](https://readthedocs.org/projects/pandera/badge/?version=stable&style=for-the-badge)](https://pandera.readthedocs.io/en/stable/?badge=stable)\n[![PyPI version shields.io](https://img.shields.io/pypi/v/pandera.svg?style=for-the-badge)](https://pypi.org/project/pandera/)\n[![PyPI license](https://img.shields.io/pypi/l/pandera.svg?style=for-the-badge)](https://pypi.python.org/pypi/)\n[![pyOpenSci](https://go.union.ai/pandera-pyopensci-badge)](https://github.com/pyOpenSci/software-review/issues/12)\n[![Project Status: Active \u2013 The project has reached a stable, usable state and is being actively developed.](https://img.shields.io/badge/repo%20status-Active-Green?style=for-the-badge)](https://www.repostatus.org/#active)\n[![Documentation Status](https://readthedocs.org/projects/pandera/badge/?version=latest&style=for-the-badge)](https://pandera.readthedocs.io/en/latest/?badge=latest)\n[![codecov](https://img.shields.io/codecov/c/github/unionai-oss/pandera?style=for-the-badge)](https://codecov.io/gh/unionai-oss/pandera)\n[![PyPI pyversions](https://img.shields.io/pypi/pyversions/pandera.svg?style=for-the-badge)](https://pypi.python.org/pypi/pandera/)\n[![DOI](https://img.shields.io/badge/DOI-10.5281/zenodo.3385265-blue?style=for-the-badge)](https://doi.org/10.5281/zenodo.3385265)\n[![asv](http://img.shields.io/badge/benchmarked%20by-asv-green.svg?style=for-the-badge)](https://pandera-dev.github.io/pandera-asv-logs/)\n[![Monthly Downloads](https://img.shields.io/pypi/dm/pandera?style=for-the-badge&color=blue)](https://pepy.tech/project/pandera)\n[![Total Downloads](https://img.shields.io/pepy/dt/pandera?style=for-the-badge&color=blue)](https://pepy.tech/project/pandera)\n[![Conda Downloads](https://img.shields.io/conda/dn/conda-forge/pandera?style=for-the-badge)](https://anaconda.org/conda-forge/pandera)\n[![Slack](https://img.shields.io/badge/Slack-4A154B?logo=slack&logoColor=fff&style=for-the-badge)](https://flyte-org.slack.com/archives/C08FDTY2X3L)\n\nPandera is a [Union.ai](https://union.ai/blog-post/pandera-joins-union-ai) open\nsource project that provides a flexible and expressive API for performing data\nvalidation on dataframe-like objects. The goal of Pandera is to make data\nprocessing pipelines more readable and robust with statistically typed\ndataframes.\n\n## Install\n\nPandera supports [multiple dataframe libraries](https://pandera.readthedocs.io/en/stable/supported_libraries.html), including [pandas](http://pandas.pydata.org), [polars](https://docs.pola.rs/), [pyspark](https://spark.apache.org/docs/latest/api/python/index.html), and more. To validate `pandas` DataFrames, install Pandera with the `pandas` extra:\n\n**With `pip`:**\n\n```\npip install 'pandera[pandas]'\n```\n\n**With `uv`:**\n\n```\nuv pip install 'pandera[pandas]'\n```\n\n**With `conda`:**\n\n```\nconda install -c conda-forge pandera-pandas\n```\n\n## Get started\n\nFirst, create a dataframe:\n\n```python\nimport pandas as pd\nimport pandera.pandas as pa\n\n# data to validate\ndf = pd.DataFrame({\n    \"column1\": [1, 2, 3],\n    \"column2\": [1.1, 1.2, 1.3],\n    \"column3\": [\"a\", \"b\", \"c\"],\n})\n```\n\nValidate the data using the object-based API:\n\n```python\n# define a schema\nschema = pa.DataFrameSchema({\n    \"column1\": pa.Column(int, pa.Check.ge(0)),\n    \"column2\": pa.Column(float, pa.Check.lt(10)),\n    \"column3\": pa.Column(\n        str,\n        [\n            pa.Check.isin([*\"abc\"]),\n            pa.Check(lambda series: series.str.len() == 1),\n        ]\n    ),\n})\n\nprint(schema.validate(df))\n#    column1  column2 column3\n# 0        1      1.1       a\n# 1        2      1.2       b\n# 2        3      1.3       c\n```\n\nOr validate the data using the class-based API:\n\n```python\n# define a schema\nclass Schema(pa.DataFrameModel):\n    column1: int = pa.Field(ge=0)\n    column2: float = pa.Field(lt=10)\n    column3: str = pa.Field(isin=[*\"abc\"])\n\n    @pa.check(\"column3\")\n    def custom_check(cls, series: pd.Series) -> pd.Series:\n        return series.str.len() == 1\n\nprint(Schema.validate(df))\n#    column1  column2 column3\n# 0        1      1.1       a\n# 1        2      1.2       b\n# 2        3      1.3       c\n```\n\n\n> [!WARNING]\n> Pandera `v0.24.0` introduces the `pandera.pandas` module, which is now the\n> (highly) recommended way of defining `DataFrameSchema`s and `DataFrameModel`s\n> for `pandas` data structures like `DataFrame`s. Defining a dataframe schema from\n> the top-level `pandera` module will produce a `FutureWarning`:\n>\n> ```python\n> import pandera as pa\n>\n> schema = pa.DataFrameSchema({\"col\": pa.Column(str)})\n> ```\n>\n> Update your import to:\n>\n> ```python\n> import pandera.pandas as pa\n> ```\n>\n> And all of the rest of your pandera code should work. Using the top-level\n> `pandera` module to access `DataFrameSchema` and the other pandera classes\n> or functions will be deprecated in a future version\n\n\n## Next steps\n\nSee the [official documentation](https://pandera.readthedocs.io) to learn more.\n",
    "bugtrack_url": null,
    "license": "MIT License\n        \n        Copyright (c) 2018 Niels Bantilan\n        \n        Permission is hereby granted, free of charge, to any person obtaining a copy\n        of this software and associated documentation files (the \"Software\"), to deal\n        in the Software without restriction, including without limitation the rights\n        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n        copies of the Software, and to permit persons to whom the Software is\n        furnished to do so, subject to the following conditions:\n        \n        The above copyright notice and this permission notice shall be included in all\n        copies or substantial portions of the Software.\n        \n        THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n        SOFTWARE.\n        ",
    "summary": "A light-weight and flexible data validation and testing tool for statistical data objects.",
    "version": "0.25.0",
    "project_urls": {
        "Documentation": "https://pandera.readthedocs.io",
        "Homepage": "https://github.com/pandera-dev/pandera",
        "Issue Tracker": "https://github.com/pandera-dev/pandera/issues"
    },
    "split_keywords": [
        "pandas",
        " validation",
        " data-structures"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "71e0234707103c742555e1c23bff51f3f0e496c144cd76fcf5a6b800dfe193f2",
                "md5": "c307c797f756ca0cb26d1e8004ffbf71",
                "sha256": "365a555accc46404466641203e297722d424d74a1315f077ab899e1344f82303"
            },
            "downloads": -1,
            "filename": "pandera-0.25.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "c307c797f756ca0cb26d1e8004ffbf71",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.9",
            "size": 293336,
            "upload_time": "2025-07-08T19:20:20",
            "upload_time_iso_8601": "2025-07-08T19:20:20.440243Z",
            "url": "https://files.pythonhosted.org/packages/71/e0/234707103c742555e1c23bff51f3f0e496c144cd76fcf5a6b800dfe193f2/pandera-0.25.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "13c102f78cd18cd32a009405c847dcf430a97d1a8c162f6e8872acae928c8f20",
                "md5": "386c39e619179a9a04473e72aec1b1a8",
                "sha256": "af3bbaa163672c91b83d59d70715f25c4134dbccfc8bc89a642a2f0e23db951e"
            },
            "downloads": -1,
            "filename": "pandera-0.25.0.tar.gz",
            "has_sig": false,
            "md5_digest": "386c39e619179a9a04473e72aec1b1a8",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.9",
            "size": 555391,
            "upload_time": "2025-07-08T19:20:22",
            "upload_time_iso_8601": "2025-07-08T19:20:22.106587Z",
            "url": "https://files.pythonhosted.org/packages/13/c1/02f78cd18cd32a009405c847dcf430a97d1a8c162f6e8872acae928c8f20/pandera-0.25.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-07-08 19:20:22",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "pandera-dev",
    "github_project": "pandera",
    "travis_ci": false,
    "coveralls": true,
    "github_actions": true,
    "requirements": [
        {
            "name": "pip",
            "specs": []
        },
        {
            "name": "packaging",
            "specs": [
                [
                    ">=",
                    "20.0"
                ]
            ]
        },
        {
            "name": "typing_extensions",
            "specs": []
        },
        {
            "name": "hypothesis",
            "specs": [
                [
                    ">=",
                    "6.92.7"
                ]
            ]
        },
        {
            "name": "pyyaml",
            "specs": [
                [
                    ">=",
                    "5.1"
                ]
            ]
        },
        {
            "name": "typing_inspect",
            "specs": [
                [
                    ">=",
                    "0.6.0"
                ]
            ]
        },
        {
            "name": "frictionless",
            "specs": [
                [
                    "<=",
                    "4.40.8"
                ]
            ]
        },
        {
            "name": "pyarrow",
            "specs": [
                [
                    ">=",
                    "13"
                ]
            ]
        },
        {
            "name": "pydantic",
            "specs": []
        },
        {
            "name": "scipy",
            "specs": []
        },
        {
            "name": "pandas-stubs",
            "specs": []
        },
        {
            "name": "pyspark",
            "specs": [
                [
                    "<",
                    "4.0.0"
                ],
                [
                    ">=",
                    "3.2.0"
                ]
            ]
        },
        {
            "name": "polars",
            "specs": [
                [
                    ">=",
                    "0.20.0"
                ]
            ]
        },
        {
            "name": "modin",
            "specs": []
        },
        {
            "name": "protobuf",
            "specs": []
        },
        {
            "name": "geopandas",
            "specs": [
                [
                    "<",
                    "1.1.0"
                ]
            ]
        },
        {
            "name": "shapely",
            "specs": []
        },
        {
            "name": "fastapi",
            "specs": []
        },
        {
            "name": "black",
            "specs": [
                [
                    ">=",
                    "24.0"
                ]
            ]
        },
        {
            "name": "numpy",
            "specs": [
                [
                    ">=",
                    "1.24.4"
                ]
            ]
        },
        {
            "name": "pandas",
            "specs": [
                [
                    ">=",
                    "2.1.1"
                ]
            ]
        },
        {
            "name": "isort",
            "specs": [
                [
                    ">=",
                    "5.7.0"
                ]
            ]
        },
        {
            "name": "joblib",
            "specs": []
        },
        {
            "name": "mypy",
            "specs": [
                [
                    "==",
                    "1.10.0"
                ]
            ]
        },
        {
            "name": "pylint",
            "specs": [
                [
                    "<",
                    "3.3"
                ]
            ]
        },
        {
            "name": "pytest",
            "specs": []
        },
        {
            "name": "pytest-cov",
            "specs": []
        },
        {
            "name": "pytest-xdist",
            "specs": []
        },
        {
            "name": "pytest-asyncio",
            "specs": []
        },
        {
            "name": "pytz",
            "specs": []
        },
        {
            "name": "xdoctest",
            "specs": []
        },
        {
            "name": "nox",
            "specs": []
        },
        {
            "name": "uv",
            "specs": []
        },
        {
            "name": "setuptools",
            "specs": []
        },
        {
            "name": "ibis-framework",
            "specs": []
        },
        {
            "name": "uvicorn",
            "specs": []
        },
        {
            "name": "python-multipart",
            "specs": []
        },
        {
            "name": "duckdb",
            "specs": []
        },
        {
            "name": "sphinx",
            "specs": []
        },
        {
            "name": "sphinx-design",
            "specs": []
        },
        {
            "name": "sphinx-autodoc-typehints",
            "specs": [
                [
                    "<=",
                    "1.14.1"
                ]
            ]
        },
        {
            "name": "sphinx-copybutton",
            "specs": []
        },
        {
            "name": "recommonmark",
            "specs": []
        },
        {
            "name": "myst-nb",
            "specs": []
        },
        {
            "name": "twine",
            "specs": []
        },
        {
            "name": "asv",
            "specs": [
                [
                    ">=",
                    "0.5.1"
                ]
            ]
        },
        {
            "name": "pre_commit",
            "specs": []
        },
        {
            "name": "dask",
            "specs": []
        },
        {
            "name": "distributed",
            "specs": []
        },
        {
            "name": "ibis-framework",
            "specs": [
                [
                    ">=",
                    "9.0.0"
                ]
            ]
        },
        {
            "name": "furo",
            "specs": []
        },
        {
            "name": "sphinx-docsearch",
            "specs": []
        },
        {
            "name": "grpcio",
            "specs": []
        },
        {
            "name": "ray",
            "specs": []
        },
        {
            "name": "typeguard",
            "specs": []
        },
        {
            "name": "types-click",
            "specs": []
        },
        {
            "name": "types-pytz",
            "specs": []
        },
        {
            "name": "types-pyyaml",
            "specs": []
        },
        {
            "name": "types-requests",
            "specs": []
        },
        {
            "name": "types-setuptools",
            "specs": []
        }
    ],
    "lcname": "pandera"
}
        
Elapsed time: 1.76837s