



pandera

 body {

 --color-code-background: #f8f8f8;

 --color-code-foreground: black;

 --color-brand-primary: #26b079;

 --color-brand-content: #26b079;

 --color-api-highlight-on-target: #e5fff5;

 

 }

 @media not print {

 body[data-theme="dark"] {

 --color-code-background: #202020;

 --color-code-foreground: #d0d0d0;

 --color-brand-primary: #26b079;

 --color-brand-content: #26b079;

 --color-api-highlight-on-target: #e5fff5;

 

 }

 @media (prefers-color-scheme: dark) {

 body:not([data-theme="light"]) {

 --color-code-background: #202020;

 --color-code-foreground: #d0d0d0;

 --color-brand-primary: #26b079;

 --color-brand-content: #26b079;

 --color-api-highlight-on-target: #e5fff5;

 

 }

 }

 }

Contents

Menu

Expand

Light mode

Dark mode

Auto light/dark mode

Hide navigation sidebar

Hide table of contents sidebar

Toggle site navigation sidebar

[pandera](#)

Toggle Light / Dark / Auto color theme

Toggle table of contents sidebar

[![Logo](_static/pandera-logo.png)

pandera](#)

Introduction

* [A Statistical Data Testing Toolkit](index.html#document-index)

* [▶️ Try Pandera](index.html#document-try_pandera)

User Guide

* [DataFrame Schemas](index.html#document-dataframe_schemas)

* [Schema Models](index.html#document-schema_models)

* [Series Schemas](index.html#document-series_schemas)

* [Checks](index.html#document-checks)

* [Hypothesis Testing](index.html#document-hypothesis)

* [Pandera Data Types](index.html#document-dtypes)

* [Decorators for Pipeline Integration](index.html#document-decorators)

* [Schema Inference](index.html#document-schema_inference)

* [Lazy Validation](index.html#document-lazy_validation)

* [Data Synthesis Strategies](index.html#document-data_synthesis_strategies)

* [Extensions](index.html#document-extensions)

* [Data Format Conversion](index.html#document-data_format_conversion)

* [Supported DataFrame Libraries](index.html#document-supported_libraries)Toggle child pages in navigation

	+ [GeoPandas](index.html#document-geopandas)

	+ [Dask](index.html#document-dask)

	+ [Fugue](index.html#document-fugue)

	+ [Koalas](index.html#document-koalas)

	+ [Pyspark ⭐️ (New)](index.html#document-pyspark)

	+ [Modin](index.html#document-modin)

* [Integrations](index.html#document-integrations)Toggle child pages in navigation

	+ [FastAPI](index.html#document-fastapi)

	+ [Frictionless](index.html#document-frictionless)

	+ [Hypothesis](index.html#document-data_synthesis_strategies)

	+ [Mypy](index.html#document-mypy_integration)

	+ [Pydantic](index.html#document-pydantic_integration)

Reference

* [API](index.html#document-reference/index)Toggle child pages in navigation

	+ [Core](index.html#document-reference/core)Toggle child pages in navigation

		- [pandera.schemas.DataFrameSchema](index.html#document-reference/generated/pandera.schemas.DataFrameSchema)Toggle child pages in navigation

			* [pandera.schemas.DataFrameSchema.\_\_init\_\_](index.html#document-reference/generated/methods/pandera.schemas.DataFrameSchema.__init__)

			* [pandera.schemas.DataFrameSchema.add\_columns](index.html#document-reference/generated/methods/pandera.schemas.DataFrameSchema.add_columns)

			* [pandera.schemas.DataFrameSchema.coerce\_dtype](index.html#document-reference/generated/methods/pandera.schemas.DataFrameSchema.coerce_dtype)

			* [pandera.schemas.DataFrameSchema.example](index.html#document-reference/generated/methods/pandera.schemas.DataFrameSchema.example)

			* [pandera.schemas.DataFrameSchema.from\_json](index.html#document-reference/generated/methods/pandera.schemas.DataFrameSchema.from_json)

			* [pandera.schemas.DataFrameSchema.from\_yaml](index.html#document-reference/generated/methods/pandera.schemas.DataFrameSchema.from_yaml)

			* [pandera.schemas.DataFrameSchema.get\_dtypes](index.html#document-reference/generated/methods/pandera.schemas.DataFrameSchema.get_dtypes)

			* [pandera.schemas.DataFrameSchema.remove\_columns](index.html#document-reference/generated/methods/pandera.schemas.DataFrameSchema.remove_columns)

			* [pandera.schemas.DataFrameSchema.rename\_columns](index.html#document-reference/generated/methods/pandera.schemas.DataFrameSchema.rename_columns)

			* [pandera.schemas.DataFrameSchema.reset\_index](index.html#document-reference/generated/methods/pandera.schemas.DataFrameSchema.reset_index)

			* [pandera.schemas.DataFrameSchema.select\_columns](index.html#document-reference/generated/methods/pandera.schemas.DataFrameSchema.select_columns)

			* [pandera.schemas.DataFrameSchema.set\_index](index.html#document-reference/generated/methods/pandera.schemas.DataFrameSchema.set_index)

			* [pandera.schemas.DataFrameSchema.strategy](index.html#document-reference/generated/methods/pandera.schemas.DataFrameSchema.strategy)

			* [pandera.schemas.DataFrameSchema.to\_json](index.html#document-reference/generated/methods/pandera.schemas.DataFrameSchema.to_json)

			* [pandera.schemas.DataFrameSchema.to\_script](index.html#document-reference/generated/methods/pandera.schemas.DataFrameSchema.to_script)

			* [pandera.schemas.DataFrameSchema.to\_yaml](index.html#document-reference/generated/methods/pandera.schemas.DataFrameSchema.to_yaml)

			* [pandera.schemas.DataFrameSchema.update\_column](index.html#document-reference/generated/methods/pandera.schemas.DataFrameSchema.update_column)

			* [pandera.schemas.DataFrameSchema.update\_columns](index.html#document-reference/generated/methods/pandera.schemas.DataFrameSchema.update_columns)

			* [pandera.schemas.DataFrameSchema.validate](index.html#document-reference/generated/methods/pandera.schemas.DataFrameSchema.validate)

			* [pandera.schemas.DataFrameSchema.\_\_call\_\_](index.html#document-reference/generated/methods/pandera.schemas.DataFrameSchema.__call__)

		- [pandera.schemas.SeriesSchema](index.html#document-reference/generated/pandera.schemas.SeriesSchema)Toggle child pages in navigation

			* [pandera.schemas.SeriesSchema.\_\_init\_\_](index.html#document-reference/generated/methods/pandera.schemas.SeriesSchema.__init__)

			* [pandera.schemas.SeriesSchema.validate](index.html#document-reference/generated/methods/pandera.schemas.SeriesSchema.validate)

			* [pandera.schemas.SeriesSchema.\_\_call\_\_](index.html#document-reference/generated/methods/pandera.schemas.SeriesSchema.__call__)

		- [pandera.schema\_components.Column](index.html#document-reference/generated/pandera.schema_components.Column)Toggle child pages in navigation

			* [pandera.schema\_components.Column.\_\_init\_\_](index.html#document-reference/generated/methods/pandera.schema_components.Column.__init__)

			* [pandera.schema\_components.Column.coerce\_dtype](index.html#document-reference/generated/methods/pandera.schema_components.Column.coerce_dtype)

			* [pandera.schema\_components.Column.example](index.html#document-reference/generated/methods/pandera.schema_components.Column.example)

			* [pandera.schema\_components.Column.get\_regex\_columns](index.html#document-reference/generated/methods/pandera.schema_components.Column.get_regex_columns)

			* [pandera.schema\_components.Column.set\_name](index.html#document-reference/generated/methods/pandera.schema_components.Column.set_name)

			* [pandera.schema\_components.Column.strategy](index.html#document-reference/generated/methods/pandera.schema_components.Column.strategy)

			* [pandera.schema\_components.Column.strategy\_component](index.html#document-reference/generated/methods/pandera.schema_components.Column.strategy_component)

			* [pandera.schema\_components.Column.validate](index.html#document-reference/generated/methods/pandera.schema_components.Column.validate)

			* [pandera.schema\_components.Column.\_\_call\_\_](index.html#document-reference/generated/methods/pandera.schema_components.Column.__call__)

		- [pandera.schema\_components.Index](index.html#document-reference/generated/pandera.schema_components.Index)Toggle child pages in navigation

			* [pandera.schema\_components.Index.example](index.html#document-reference/generated/methods/pandera.schema_components.Index.example)

			* [pandera.schema\_components.Index.strategy](index.html#document-reference/generated/methods/pandera.schema_components.Index.strategy)

			* [pandera.schema\_components.Index.strategy\_component](index.html#document-reference/generated/methods/pandera.schema_components.Index.strategy_component)

			* [pandera.schema\_components.Index.validate](index.html#document-reference/generated/methods/pandera.schema_components.Index.validate)

			* [pandera.schema\_components.Index.\_\_call\_\_](index.html#document-reference/generated/methods/pandera.schema_components.Index.__call__)

		- [pandera.schema\_components.MultiIndex](index.html#document-reference/generated/pandera.schema_components.MultiIndex)Toggle child pages in navigation

			* [pandera.schema\_components.MultiIndex.\_\_init\_\_](index.html#document-reference/generated/methods/pandera.schema_components.MultiIndex.__init__)

			* [pandera.schema\_components.MultiIndex.coerce\_dtype](index.html#document-reference/generated/methods/pandera.schema_components.MultiIndex.coerce_dtype)

			* [pandera.schema\_components.MultiIndex.example](index.html#document-reference/generated/methods/pandera.schema_components.MultiIndex.example)

			* [pandera.schema\_components.MultiIndex.strategy](index.html#document-reference/generated/methods/pandera.schema_components.MultiIndex.strategy)

			* [pandera.schema\_components.MultiIndex.validate](index.html#document-reference/generated/methods/pandera.schema_components.MultiIndex.validate)

			* [pandera.schema\_components.MultiIndex.\_\_call\_\_](index.html#document-reference/generated/methods/pandera.schema_components.MultiIndex.__call__)

		- [pandera.checks.Check](index.html#document-reference/generated/pandera.checks.Check)Toggle child pages in navigation

			* [pandera.checks.Check.eq](index.html#document-reference/generated/methods/pandera.checks.Check.eq)

			* [pandera.checks.Check.equal\_to](index.html#document-reference/generated/methods/pandera.checks.Check.equal_to)

			* [pandera.checks.Check.ge](index.html#document-reference/generated/methods/pandera.checks.Check.ge)

			* [pandera.checks.Check.greater\_than](index.html#document-reference/generated/methods/pandera.checks.Check.greater_than)

			* [pandera.checks.Check.greater\_than\_or\_equal\_to](index.html#document-reference/generated/methods/pandera.checks.Check.greater_than_or_equal_to)

			* [pandera.checks.Check.gt](index.html#document-reference/generated/methods/pandera.checks.Check.gt)

			* [pandera.checks.Check.in\_range](index.html#document-reference/generated/methods/pandera.checks.Check.in_range)

			* [pandera.checks.Check.isin](index.html#document-reference/generated/methods/pandera.checks.Check.isin)

			* [pandera.checks.Check.le](index.html#document-reference/generated/methods/pandera.checks.Check.le)

			* [pandera.checks.Check.less\_than](index.html#document-reference/generated/methods/pandera.checks.Check.less_than)

			* [pandera.checks.Check.less\_than\_or\_equal\_to](index.html#document-reference/generated/methods/pandera.checks.Check.less_than_or_equal_to)

			* [pandera.checks.Check.lt](index.html#document-reference/generated/methods/pandera.checks.Check.lt)

			* [pandera.checks.Check.ne](index.html#document-reference/generated/methods/pandera.checks.Check.ne)

			* [pandera.checks.Check.not\_equal\_to](index.html#document-reference/generated/methods/pandera.checks.Check.not_equal_to)

			* [pandera.checks.Check.notin](index.html#document-reference/generated/methods/pandera.checks.Check.notin)

			* [pandera.checks.Check.str\_contains](index.html#document-reference/generated/methods/pandera.checks.Check.str_contains)

			* [pandera.checks.Check.str\_endswith](index.html#document-reference/generated/methods/pandera.checks.Check.str_endswith)

			* [pandera.checks.Check.str\_length](index.html#document-reference/generated/methods/pandera.checks.Check.str_length)

			* [pandera.checks.Check.str\_matches](index.html#document-reference/generated/methods/pandera.checks.Check.str_matches)

			* [pandera.checks.Check.str\_startswith](index.html#document-reference/generated/methods/pandera.checks.Check.str_startswith)

			* [pandera.checks.Check.unique\_values\_eq](index.html#document-reference/generated/methods/pandera.checks.Check.unique_values_eq)

			* [pandera.checks.Check.\_\_call\_\_](index.html#document-reference/generated/methods/pandera.checks.Check.__call__)

		- [pandera.hypotheses.Hypothesis](index.html#document-reference/generated/pandera.hypotheses.Hypothesis)Toggle child pages in navigation

			* [pandera.hypotheses.Hypothesis.\_\_init\_\_](index.html#document-reference/generated/methods/pandera.hypotheses.Hypothesis.__init__)

			* [pandera.hypotheses.Hypothesis.one\_sample\_ttest](index.html#document-reference/generated/methods/pandera.hypotheses.Hypothesis.one_sample_ttest)

			* [pandera.hypotheses.Hypothesis.two\_sample\_ttest](index.html#document-reference/generated/methods/pandera.hypotheses.Hypothesis.two_sample_ttest)

			* [pandera.hypotheses.Hypothesis.\_\_call\_\_](index.html#document-reference/generated/methods/pandera.hypotheses.Hypothesis.__call__)

- [Data Types](index.html#document-reference/dtypes)Toggle child pages in navigation

	* [pandera.dtypes.DataType](index.html#document-reference/generated/pandera.dtypes.DataType)Toggle child pages in navigation

		+ [pandera.dtypes.DataType.\_\_init\_\_](index.html#document-reference/generated/methods/pandera.dtypes.DataType.__init__)

		+ [pandera.dtypes.DataType.check](index.html#document-reference/generated/methods/pandera.dtypes.DataType.check)

		+ [pandera.dtypes.DataType.coerce](index.html#document-reference/generated/methods/pandera.dtypes.DataType.coerce)

		+ [pandera.dtypes.DataType.coerce\_value](index.html#document-reference/generated/methods/pandera.dtypes.DataType.coerce_value)

		+ [pandera.dtypes.DataType.try\_coerce](index.html#document-reference/generated/methods/pandera.dtypes.DataType.try_coerce)

		+ [pandera.dtypes.DataType.\_\_call\_\_](index.html#document-reference/generated/methods/pandera.dtypes.DataType.__call__)

	* [pandera.dtypes.Bool](index.html#document-reference/generated/pandera.dtypes.Bool)Toggle child pages in navigation

		+ [pandera.dtypes.Bool.\_\_init\_\_](index.html#document-reference/generated/methods/pandera.dtypes.Bool.__init__)

		+ [pandera.dtypes.Bool.check](index.html#document-reference/generated/methods/pandera.dtypes.Bool.check)

		+ [pandera.dtypes.Bool.coerce](index.html#document-reference/generated/methods/pandera.dtypes.Bool.coerce)

		+ [pandera.dtypes.Bool.coerce\_value](index.html#document-reference/generated/methods/pandera.dtypes.Bool.coerce_value)

		+ [pandera.dtypes.Bool.try\_coerce](index.html#document-reference/generated/methods/pandera.dtypes.Bool.try_coerce)

		+ [pandera.dtypes.Bool.\_\_call\_\_](index.html#document-reference/generated/methods/pandera.dtypes.Bool.__call__)

	* [pandera.dtypes.Timestamp](index.html#document-reference/generated/pandera.dtypes.Timestamp)Toggle child pages in navigation

		+ [pandera.dtypes.Timestamp.\_\_init\_\_](index.html#document-reference/generated/methods/pandera.dtypes.Timestamp.__init__)

		+ [pandera.dtypes.Timestamp.check](index.html#document-reference/generated/methods/pandera.dtypes.Timestamp.check)

		+ [pandera.dtypes.Timestamp.coerce](index.html#document-reference/generated/methods/pandera.dtypes.Timestamp.coerce)

		+ [pandera.dtypes.Timestamp.coerce\_value](index.html#document-reference/generated/methods/pandera.dtypes.Timestamp.coerce_value)

		+ [pandera.dtypes.Timestamp.try\_coerce](index.html#document-reference/generated/methods/pandera.dtypes.Timestamp.try_coerce)

		+ [pandera.dtypes.Timestamp.\_\_call\_\_](index.html#document-reference/generated/methods/pandera.dtypes.Timestamp.__call__)

	* [pandera.dtypes.DateTime](index.html#document-reference/generated/pandera.dtypes.DateTime)

	* [pandera.dtypes.Timedelta](index.html#document-reference/generated/pandera.dtypes.Timedelta)Toggle child pages in navigation

		+ [pandera.dtypes.Timedelta.\_\_init\_\_](index.html#document-reference/generated/methods/pandera.dtypes.Timedelta.__init__)

		+ [pandera.dtypes.Timedelta.check](index.html#document-reference/generated/methods/pandera.dtypes.Timedelta.check)

		+ [pandera.dtypes.Timedelta.coerce](index.html#document-reference/generated/methods/pandera.dtypes.Timedelta.coerce)

		+ [pandera.dtypes.Timedelta.coerce\_value](index.html#document-reference/generated/methods/pandera.dtypes.Timedelta.coerce_value)

		+ [pandera.dtypes.Timedelta.try\_coerce](index.html#document-reference/generated/methods/pandera.dtypes.Timedelta.try_coerce)

		+ [pandera.dtypes.Timedelta.\_\_call\_\_](index.html#document-reference/generated/methods/pandera.dtypes.Timedelta.__call__)

	* [pandera.dtypes.Category](index.html#document-reference/generated/pandera.dtypes.Category)Toggle child pages in navigation

		+ [pandera.dtypes.Category.\_\_init\_\_](index.html#document-reference/generated/methods/pandera.dtypes.Category.__init__)

		+ [pandera.dtypes.Category.check](index.html#document-reference/generated/methods/pandera.dtypes.Category.check)

		+ [pandera.dtypes.Category.coerce](index.html#document-reference/generated/methods/pandera.dtypes.Category.coerce)

		+ [pandera.dtypes.Category.coerce\_value](index.html#document-reference/generated/methods/pandera.dtypes.Category.coerce_value)

		+ [pandera.dtypes.Category.try\_coerce](index.html#document-reference/generated/methods/pandera.dtypes.Category.try_coerce)

		+ [pandera.dtypes.Category.\_\_call\_\_](index.html#document-reference/generated/methods/pandera.dtypes.Category.__call__)

	* [pandera.dtypes.Float](index.html#document-reference/generated/pandera.dtypes.Float)Toggle child pages in navigation

		+ [pandera.dtypes.Float.\_\_init\_\_](index.html#document-reference/generated/methods/pandera.dtypes.Float.__init__)

		+ [pandera.dtypes.Float.check](index.html#document-reference/generated/methods/pandera.dtypes.Float.check)

		+ [pandera.dtypes.Float.coerce](index.html#document-reference/generated/methods/pandera.dtypes.Float.coerce)

		+ [pandera.dtypes.Float.coerce\_value](index.html#document-reference/generated/methods/pandera.dtypes.Float.coerce_value)

		+ [pandera.dtypes.Float.try\_coerce](index.html#document-reference/generated/methods/pandera.dtypes.Float.try_coerce)

		+ [pandera.dtypes.Float.\_\_call\_\_](index.html#document-reference/generated/methods/pandera.dtypes.Float.__call__)

	* [pandera.dtypes.Float16](index.html#document-reference/generated/pandera.dtypes.Float16)Toggle child pages in navigation

		+ [pandera.dtypes.Float16.\_\_init\_\_](index.html#document-reference/generated/methods/pandera.dtypes.Float16.__init__)

		+ [pandera.dtypes.Float16.check](index.html#document-reference/generated/methods/pandera.dtypes.Float16.check)

		+ [pandera.dtypes.Float16.coerce](index.html#document-reference/generated/methods/pandera.dtypes.Float16.coerce)

		+ [pandera.dtypes.Float16.coerce\_value](index.html#document-reference/generated/methods/pandera.dtypes.Float16.coerce_value)

		+ [pandera.dtypes.Float16.try\_coerce](index.html#document-reference/generated/methods/pandera.dtypes.Float16.try_coerce)

		+ [pandera.dtypes.Float16.\_\_call\_\_](index.html#document-reference/generated/methods/pandera.dtypes.Float16.__call__)

	* [pandera.dtypes.Float32](index.html#document-reference/generated/pandera.dtypes.Float32)Toggle child pages in navigation

		+ [pandera.dtypes.Float32.\_\_init\_\_](index.html#document-reference/generated/methods/pandera.dtypes.Float32.__init__)

		+ [pandera.dtypes.Float32.check](index.html#document-reference/generated/methods/pandera.dtypes.Float32.check)

		+ [pandera.dtypes.Float32.coerce](index.html#document-reference/generated/methods/pandera.dtypes.Float32.coerce)

		+ [pandera.dtypes.Float32.coerce\_value](index.html#document-reference/generated/methods/pandera.dtypes.Float32.coerce_value)

		+ [pandera.dtypes.Float32.try\_coerce](index.html#document-reference/generated/methods/pandera.dtypes.Float32.try_coerce)

		+ [pandera.dtypes.Float32.\_\_call\_\_](index.html#document-reference/generated/methods/pandera.dtypes.Float32.__call__)

	* [pandera.dtypes.Float64](index.html#document-reference/generated/pandera.dtypes.Float64)Toggle child pages in navigation

		+ [pandera.dtypes.Float64.\_\_init\_\_](index.html#document-reference/generated/methods/pandera.dtypes.Float64.__init__)

		+ [pandera.dtypes.Float64.check](index.html#document-reference/generated/methods/pandera.dtypes.Float64.check)

		+ [pandera.dtypes.Float64.coerce](index.html#document-reference/generated/methods/pandera.dtypes.Float64.coerce)

		+ [pandera.dtypes.Float64.coerce\_value](index.html#document-reference/generated/methods/pandera.dtypes.Float64.coerce_value)

		+ [pandera.dtypes.Float64.try\_coerce](index.html#document-reference/generated/methods/pandera.dtypes.Float64.try_coerce)

		+ [pandera.dtypes.Float64.\_\_call\_\_](index.html#document-reference/generated/methods/pandera.dtypes.Float64.__call__)

	* [pandera.dtypes.Float128](index.html#document-reference/generated/pandera.dtypes.Float128)Toggle child pages in navigation

		+ [pandera.dtypes.Float128.\_\_init\_\_](index.html#document-reference/generated/methods/pandera.dtypes.Float128.__init__)

		+ [pandera.dtypes.Float128.check](index.html#document-reference/generated/methods/pandera.dtypes.Float128.check)

		+ [pandera.dtypes.Float128.coerce](index.html#document-reference/generated/methods/pandera.dtypes.Float128.coerce)

		+ [pandera.dtypes.Float128.coerce\_value](index.html#document-reference/generated/methods/pandera.dtypes.Float128.coerce_value)

		+ [pandera.dtypes.Float128.try\_coerce](index.html#document-reference/generated/methods/pandera.dtypes.Float128.try_coerce)

		+ [pandera.dtypes.Float128.\_\_call\_\_](index.html#document-reference/generated/methods/pandera.dtypes.Float128.__call__)

	* [pandera.dtypes.Int](index.html#document-reference/generated/pandera.dtypes.Int)Toggle child pages in navigation

		+ [pandera.dtypes.Int.\_\_init\_\_](index.html#document-reference/generated/methods/pandera.dtypes.Int.__init__)

		+ [pandera.dtypes.Int.check](index.html#document-reference/generated/methods/pandera.dtypes.Int.check)

		+ [pandera.dtypes.Int.coerce](index.html#document-reference/generated/methods/pandera.dtypes.Int.coerce)

		+ [pandera.dtypes.Int.coerce\_value](index.html#document-reference/generated/methods/pandera.dtypes.Int.coerce_value)

		+ [pandera.dtypes.Int.try\_coerce](index.html#document-reference/generated/methods/pandera.dtypes.Int.try_coerce)

		+ [pandera.dtypes.Int.\_\_call\_\_](index.html#document-reference/generated/methods/pandera.dtypes.Int.__call__)

	* [pandera.dtypes.Int8](index.html#document-reference/generated/pandera.dtypes.Int8)Toggle child pages in navigation

		+ [pandera.dtypes.Int8.\_\_init\_\_](index.html#document-reference/generated/methods/pandera.dtypes.Int8.__init__)

		+ [pandera.dtypes.Int8.check](index.html#document-reference/generated/methods/pandera.dtypes.Int8.check)

		+ [pandera.dtypes.Int8.coerce](index.html#document-reference/generated/methods/pandera.dtypes.Int8.coerce)

		+ [pandera.dtypes.Int8.coerce\_value](index.html#document-reference/generated/methods/pandera.dtypes.Int8.coerce_value)

		+ [pandera.dtypes.Int8.try\_coerce](index.html#document-reference/generated/methods/pandera.dtypes.Int8.try_coerce)

		+ [pandera.dtypes.Int8.\_\_call\_\_](index.html#document-reference/generated/methods/pandera.dtypes.Int8.__call__)

	* [pandera.dtypes.Int16](index.html#document-reference/generated/pandera.dtypes.Int16)Toggle child pages in navigation

		+ [pandera.dtypes.Int16.\_\_init\_\_](index.html#document-reference/generated/methods/pandera.dtypes.Int16.__init__)

		+ [pandera.dtypes.Int16.check](index.html#document-reference/generated/methods/pandera.dtypes.Int16.check)

		+ [pandera.dtypes.Int16.coerce](index.html#document-reference/generated/methods/pandera.dtypes.Int16.coerce)

		+ [pandera.dtypes.Int16.coerce\_value](index.html#document-reference/generated/methods/pandera.dtypes.Int16.coerce_value)

		+ [pandera.dtypes.Int16.try\_coerce](index.html#document-reference/generated/methods/pandera.dtypes.Int16.try_coerce)

		+ [pandera.dtypes.Int16.\_\_call\_\_](index.html#document-reference/generated/methods/pandera.dtypes.Int16.__call__)

	* [pandera.dtypes.Int32](index.html#document-reference/generated/pandera.dtypes.Int32)Toggle child pages in navigation

		+ [pandera.dtypes.Int32.\_\_init\_\_](index.html#document-reference/generated/methods/pandera.dtypes.Int32.__init__)

		+ [pandera.dtypes.Int32.check](index.html#document-reference/generated/methods/pandera.dtypes.Int32.check)

		+ [pandera.dtypes.Int32.coerce](index.html#document-reference/generated/methods/pandera.dtypes.Int32.coerce)

		+ [pandera.dtypes.Int32.coerce\_value](index.html#document-reference/generated/methods/pandera.dtypes.Int32.coerce_value)

		+ [pandera.dtypes.Int32.try\_coerce](index.html#document-reference/generated/methods/pandera.dtypes.Int32.try_coerce)

		+ [pandera.dtypes.Int32.\_\_call\_\_](index.html#document-reference/generated/methods/pandera.dtypes.Int32.__call__)

	* [pandera.dtypes.Int64](index.html#document-reference/generated/pandera.dtypes.Int64)Toggle child pages in navigation

		+ [pandera.dtypes.Int64.\_\_init\_\_](index.html#document-reference/generated/methods/pandera.dtypes.Int64.__init__)

		+ [pandera.dtypes.Int64.check](index.html#document-reference/generated/methods/pandera.dtypes.Int64.check)

		+ [pandera.dtypes.Int64.coerce](index.html#document-reference/generated/methods/pandera.dtypes.Int64.coerce)

		+ [pandera.dtypes.Int64.coerce\_value](index.html#document-reference/generated/methods/pandera.dtypes.Int64.coerce_value)

		+ [pandera.dtypes.Int64.try\_coerce](index.html#document-reference/generated/methods/pandera.dtypes.Int64.try_coerce)

		+ [pandera.dtypes.Int64.\_\_call\_\_](index.html#document-reference/generated/methods/pandera.dtypes.Int64.__call__)

	* [pandera.dtypes.UInt](index.html#document-reference/generated/pandera.dtypes.UInt)Toggle child pages in navigation

		+ [pandera.dtypes.UInt.\_\_init\_\_](index.html#document-reference/generated/methods/pandera.dtypes.UInt.__init__)

		+ [pandera.dtypes.UInt.check](index.html#document-reference/generated/methods/pandera.dtypes.UInt.check)

		+ [pandera.dtypes.UInt.coerce](index.html#document-reference/generated/methods/pandera.dtypes.UInt.coerce)

		+ [pandera.dtypes.UInt.coerce\_value](index.html#document-reference/generated/methods/pandera.dtypes.UInt.coerce_value)

		+ [pandera.dtypes.UInt.try\_coerce](index.html#document-reference/generated/methods/pandera.dtypes.UInt.try_coerce)

		+ [pandera.dtypes.UInt.\_\_call\_\_](index.html#document-reference/generated/methods/pandera.dtypes.UInt.__call__)

	* [pandera.dtypes.UInt8](index.html#document-reference/generated/pandera.dtypes.UInt8)Toggle child pages in navigation

		+ [pandera.dtypes.UInt8.\_\_init\_\_](index.html#document-reference/generated/methods/pandera.dtypes.UInt8.__init__)

		+ [pandera.dtypes.UInt8.check](index.html#document-reference/generated/methods/pandera.dtypes.UInt8.check)

		+ [pandera.dtypes.UInt8.coerce](index.html#document-reference/generated/methods/pandera.dtypes.UInt8.coerce)

		+ [pandera.dtypes.UInt8.coerce\_value](index.html#document-reference/generated/methods/pandera.dtypes.UInt8.coerce_value)

		+ [pandera.dtypes.UInt8.try\_coerce](index.html#document-reference/generated/methods/pandera.dtypes.UInt8.try_coerce)

		+ [pandera.dtypes.UInt8.\_\_call\_\_](index.html#document-reference/generated/methods/pandera.dtypes.UInt8.__call__)

	* [pandera.dtypes.UInt16](index.html#document-reference/generated/pandera.dtypes.UInt16)Toggle child pages in navigation

		+ [pandera.dtypes.UInt16.\_\_init\_\_](index.html#document-reference/generated/methods/pandera.dtypes.UInt16.__init__)

		+ [pandera.dtypes.UInt16.check](index.html#document-reference/generated/methods/pandera.dtypes.UInt16.check)

		+ [pandera.dtypes.UInt16.coerce](index.html#document-reference/generated/methods/pandera.dtypes.UInt16.coerce)

		+ [pandera.dtypes.UInt16.coerce\_value](index.html#document-reference/generated/methods/pandera.dtypes.UInt16.coerce_value)

		+ [pandera.dtypes.UInt16.try\_coerce](index.html#document-reference/generated/methods/pandera.dtypes.UInt16.try_coerce)

		+ [pandera.dtypes.UInt16.\_\_call\_\_](index.html#document-reference/generated/methods/pandera.dtypes.UInt16.__call__)

	* [pandera.dtypes.UInt32](index.html#document-reference/generated/pandera.dtypes.UInt32)Toggle child pages in navigation

		+ [pandera.dtypes.UInt32.\_\_init\_\_](index.html#document-reference/generated/methods/pandera.dtypes.UInt32.__init__)

		+ [pandera.dtypes.UInt32.check](index.html#document-reference/generated/methods/pandera.dtypes.UInt32.check)

		+ [pandera.dtypes.UInt32.coerce](index.html#document-reference/generated/methods/pandera.dtypes.UInt32.coerce)

		+ [pandera.dtypes.UInt32.coerce\_value](index.html#document-reference/generated/methods/pandera.dtypes.UInt32.coerce_value)

		+ [pandera.dtypes.UInt32.try\_coerce](index.html#document-reference/generated/methods/pandera.dtypes.UInt32.try_coerce)

		+ [pandera.dtypes.UInt32.\_\_call\_\_](index.html#document-reference/generated/methods/pandera.dtypes.UInt32.__call__)

	* [pandera.dtypes.UInt64](index.html#document-reference/generated/pandera.dtypes.UInt64)Toggle child pages in navigation

		+ [pandera.dtypes.UInt64.\_\_init\_\_](index.html#document-reference/generated/methods/pandera.dtypes.UInt64.__init__)

		+ [pandera.dtypes.UInt64.check](index.html#document-reference/generated/methods/pandera.dtypes.UInt64.check)

		+ [pandera.dtypes.UInt64.coerce](index.html#document-reference/generated/methods/pandera.dtypes.UInt64.coerce)

		+ [pandera.dtypes.UInt64.coerce\_value](index.html#document-reference/generated/methods/pandera.dtypes.UInt64.coerce_value)

		+ [pandera.dtypes.UInt64.try\_coerce](index.html#document-reference/generated/methods/pandera.dtypes.UInt64.try_coerce)

		+ [pandera.dtypes.UInt64.\_\_call\_\_](index.html#document-reference/generated/methods/pandera.dtypes.UInt64.__call__)

	* [pandera.dtypes.Complex](index.html#document-reference/generated/pandera.dtypes.Complex)Toggle child pages in navigation

		+ [pandera.dtypes.Complex.\_\_init\_\_](index.html#document-reference/generated/methods/pandera.dtypes.Complex.__init__)

		+ [pandera.dtypes.Complex.check](index.html#document-reference/generated/methods/pandera.dtypes.Complex.check)

		+ [pandera.dtypes.Complex.coerce](index.html#document-reference/generated/methods/pandera.dtypes.Complex.coerce)

		+ [pandera.dtypes.Complex.coerce\_value](index.html#document-reference/generated/methods/pandera.dtypes.Complex.coerce_value)

		+ [pandera.dtypes.Complex.try\_coerce](index.html#document-reference/generated/methods/pandera.dtypes.Complex.try_coerce)

		+ [pandera.dtypes.Complex.\_\_call\_\_](index.html#document-reference/generated/methods/pandera.dtypes.Complex.__call__)

	* [pandera.dtypes.Complex64](index.html#document-reference/generated/pandera.dtypes.Complex64)Toggle child pages in navigation

		+ [pandera.dtypes.Complex64.\_\_init\_\_](index.html#document-reference/generated/methods/pandera.dtypes.Complex64.__init__)

		+ [pandera.dtypes.Complex64.check](index.html#document-reference/generated/methods/pandera.dtypes.Complex64.check)

		+ [pandera.dtypes.Complex64.coerce](index.html#document-reference/generated/methods/pandera.dtypes.Complex64.coerce)

		+ [pandera.dtypes.Complex64.coerce\_value](index.html#document-reference/generated/methods/pandera.dtypes.Complex64.coerce_value)

		+ [pandera.dtypes.Complex64.try\_coerce](index.html#document-reference/generated/methods/pandera.dtypes.Complex64.try_coerce)

		+ [pandera.dtypes.Complex64.\_\_call\_\_](index.html#document-reference/generated/methods/pandera.dtypes.Complex64.__call__)

	* [pandera.dtypes.Complex128](index.html#document-reference/generated/pandera.dtypes.Complex128)Toggle child pages in navigation

		+ [pandera.dtypes.Complex128.\_\_init\_\_](index.html#document-reference/generated/methods/pandera.dtypes.Complex128.__init__)

		+ [pandera.dtypes.Complex128.check](index.html#document-reference/generated/methods/pandera.dtypes.Complex128.check)

		+ [pandera.dtypes.Complex128.coerce](index.html#document-reference/generated/methods/pandera.dtypes.Complex128.coerce)

		+ [pandera.dtypes.Complex128.coerce\_value](index.html#document-reference/generated/methods/pandera.dtypes.Complex128.coerce_value)

		+ [pandera.dtypes.Complex128.try\_coerce](index.html#document-reference/generated/methods/pandera.dtypes.Complex128.try_coerce)

		+ [pandera.dtypes.Complex128.\_\_call\_\_](index.html#document-reference/generated/methods/pandera.dtypes.Complex128.__call__)

	* [pandera.dtypes.Complex256](index.html#document-reference/generated/pandera.dtypes.Complex256)Toggle child pages in navigation

		+ [pandera.dtypes.Complex256.\_\_init\_\_](index.html#document-reference/generated/methods/pandera.dtypes.Complex256.__init__)

		+ [pandera.dtypes.Complex256.check](index.html#document-reference/generated/methods/pandera.dtypes.Complex256.check)

		+ [pandera.dtypes.Complex256.coerce](index.html#document-reference/generated/methods/pandera.dtypes.Complex256.coerce)

		+ [pandera.dtypes.Complex256.coerce\_value](index.html#document-reference/generated/methods/pandera.dtypes.Complex256.coerce_value)

		+ [pandera.dtypes.Complex256.try\_coerce](index.html#document-reference/generated/methods/pandera.dtypes.Complex256.try_coerce)

		+ [pandera.dtypes.Complex256.\_\_call\_\_](index.html#document-reference/generated/methods/pandera.dtypes.Complex256.__call__)

	* [pandera.dtypes.Decimal](index.html#document-reference/generated/pandera.dtypes.Decimal)Toggle child pages in navigation

		+ [pandera.dtypes.Decimal.\_\_init\_\_](index.html#document-reference/generated/methods/pandera.dtypes.Decimal.__init__)

		+ [pandera.dtypes.Decimal.check](index.html#document-reference/generated/methods/pandera.dtypes.Decimal.check)

		+ [pandera.dtypes.Decimal.coerce](index.html#document-reference/generated/methods/pandera.dtypes.Decimal.coerce)

		+ [pandera.dtypes.Decimal.coerce\_value](index.html#document-reference/generated/methods/pandera.dtypes.Decimal.coerce_value)

		+ [pandera.dtypes.Decimal.try\_coerce](index.html#document-reference/generated/methods/pandera.dtypes.Decimal.try_coerce)

		+ [pandera.dtypes.Decimal.\_\_call\_\_](index.html#document-reference/generated/methods/pandera.dtypes.Decimal.__call__)

	* [pandera.dtypes.String](index.html#document-reference/generated/pandera.dtypes.String)Toggle child pages in navigation

		+ [pandera.dtypes.String.\_\_init\_\_](index.html#document-reference/generated/methods/pandera.dtypes.String.__init__)

		+ [pandera.dtypes.String.check](index.html#document-reference/generated/methods/pandera.dtypes.String.check)

		+ [pandera.dtypes.String.coerce](index.html#document-reference/generated/methods/pandera.dtypes.String.coerce)

		+ [pandera.dtypes.String.coerce\_value](index.html#document-reference/generated/methods/pandera.dtypes.String.coerce_value)

		+ [pandera.dtypes.String.try\_coerce](index.html#document-reference/generated/methods/pandera.dtypes.String.try_coerce)

		+ [pandera.dtypes.String.\_\_call\_\_](index.html#document-reference/generated/methods/pandera.dtypes.String.__call__)

	* [pandera.engines.pandas\_engine.BOOL](index.html#document-reference/generated/pandera.engines.pandas_engine.BOOL)Toggle child pages in navigation

		+ [pandera.engines.pandas\_engine.BOOL.\_\_init\_\_](index.html#document-reference/generated/methods/pandera.engines.pandas_engine.BOOL.__init__)

		+ [pandera.engines.pandas\_engine.BOOL.check](index.html#document-reference/generated/methods/pandera.engines.pandas_engine.BOOL.check)

		+ [pandera.engines.pandas\_engine.BOOL.coerce](index.html#document-reference/generated/methods/pandera.engines.pandas_engine.BOOL.coerce)

		+ [pandera.engines.pandas\_engine.BOOL.coerce\_value](index.html#document-reference/generated/methods/pandera.engines.pandas_engine.BOOL.coerce_value)

		+ [pandera.engines.pandas\_engine.BOOL.try\_coerce](index.html#document-reference/generated/methods/pandera.engines.pandas_engine.BOOL.try_coerce)

		+ [pandera.engines.pandas\_engine.BOOL.\_\_call\_\_](index.html#document-reference/generated/methods/pandera.engines.pandas_engine.BOOL.__call__)

	* [pandera.engines.pandas\_engine.INT8](index.html#document-reference/generated/pandera.engines.pandas_engine.INT8)Toggle child pages in navigation

		+ [pandera.engines.pandas\_engine.INT8.\_\_init\_\_](index.html#document-reference/generated/methods/pandera.engines.pandas_engine.INT8.__init__)

		+ [pandera.engines.pandas\_engine.INT8.check](index.html#document-reference/generated/methods/pandera.engines.pandas_engine.INT8.check)

		+ [pandera.engines.pandas\_engine.INT8.coerce](index.html#document-reference/generated/methods/pandera.engines.pandas_engine.INT8.coerce)

		+ [pandera.engines.pandas\_engine.INT8.coerce\_value](index.html#document-reference/generated/methods/pandera.engines.pandas_engine.INT8.coerce_value)

		+ [pandera.engines.pandas\_engine.INT8.try\_coerce](index.html#document-reference/generated/methods/pandera.engines.pandas_engine.INT8.try_coerce)

		+ [pandera.engines.pandas\_engine.INT8.\_\_call\_\_](index.html#document-reference/generated/methods/pandera.engines.pandas_engine.INT8.__call__)

	* [pandera.engines.pandas\_engine.INT16](index.html#document-reference/generated/pandera.engines.pandas_engine.INT16)Toggle child pages in navigation

		+ [pandera.engines.pandas\_engine.INT16.\_\_init\_\_](index.html#document-reference/generated/methods/pandera.engines.pandas_engine.INT16.__init__)

		+ [pandera.engines.pandas\_engine.INT16.check](index.html#document-reference/generated/methods/pandera.engines.pandas_engine.INT16.check)

		+ [pandera.engines.pandas\_engine.INT16.coerce](index.html#document-reference/generated/methods/pandera.engines.pandas_engine.INT16.coerce)

		+ [pandera.engines.pandas\_engine.INT16.coerce\_value](index.html#document-reference/generated/methods/pandera.engines.pandas_engine.INT16.coerce_value)

		+ [pandera.engines.pandas\_engine.INT16.try\_coerce](index.html#document-reference/generated/methods/pandera.engines.pandas_engine.INT16.try_coerce)

		+ [pandera.engines.pandas\_engine.INT16.\_\_call\_\_](index.html#document-reference/generated/methods/pandera.engines.pandas_engine.INT16.__call__)

	* [pandera.engines.pandas\_engine.INT32](index.html#document-reference/generated/pandera.engines.pandas_engine.INT32)Toggle child pages in navigation

		+ [pandera.engines.pandas\_engine.INT32.\_\_init\_\_](index.html#document-reference/generated/methods/pandera.engines.pandas_engine.INT32.__init__)

		+ [pandera.engines.pandas\_engine.INT32.check](index.html#document-reference/generated/methods/pandera.engines.pandas_engine.INT32.check)

		+ [pandera.engines.pandas\_engine.INT32.coerce](index.html#document-reference/generated/methods/pandera.engines.pandas_engine.INT32.coerce)

		+ [pandera.engines.pandas\_engine.INT32.coerce\_value](index.html#document-reference/generated/methods/pandera.engines.pandas_engine.INT32.coerce_value)

		+ [pandera.engines.pandas\_engine.INT32.try\_coerce](index.html#document-reference/generated/methods/pandera.engines.pandas_engine.INT32.try_coerce)

		+ [pandera.engines.pandas\_engine.INT32.\_\_call\_\_](index.html#document-reference/generated/methods/pandera.engines.pandas_engine.INT32.__call__)

	* [pandera.engines.pandas\_engine.INT64](index.html#document-reference/generated/pandera.engines.pandas_engine.INT64)Toggle child pages in navigation

		+ [pandera.engines.pandas\_engine.INT64.\_\_init\_\_](index.html#document-reference/generated/methods/pandera.engines.pandas_engine.INT64.__init__)

		+ [pandera.engines.pandas\_engine.INT64.check](index.html#document-reference/generated/methods/pandera.engines.pandas_engine.INT64.check)

		+ [pandera.engines.pandas\_engine.INT64.coerce](index.html#document-reference/generated/methods/pandera.engines.pandas_engine.INT64.coerce)

		+ [pandera.engines.pandas\_engine.INT64.coerce\_value](index.html#document-reference/generated/methods/pandera.engines.pandas_engine.INT64.coerce_value)

		+ [pandera.engines.pandas\_engine.INT64.try\_coerce](index.html#document-reference/generated/methods/pandera.engines.pandas_engine.INT64.try_coerce)

		+ [pandera.engines.pandas\_engine.INT64.\_\_call\_\_](index.html#document-reference/generated/methods/pandera.engines.pandas_engine.INT64.__call__)

	* [pandera.engines.pandas\_engine.UINT8](index.html#document-reference/generated/pandera.engines.pandas_engine.UINT8)Toggle child pages in navigation

		+ [pandera.engines.pandas\_engine.UINT8.\_\_init\_\_](index.html#document-reference/generated/methods/pandera.engines.pandas_engine.UINT8.__init__)

		+ [pandera.engines.pandas\_engine.UINT8.check](index.html#document-reference/generated/methods/pandera.engines.pandas_engine.UINT8.check)

		+ [pandera.engines.pandas\_engine.UINT8.coerce](index.html#document-reference/generated/methods/pandera.engines.pandas_engine.UINT8.coerce)

		+ [pandera.engines.pandas\_engine.UINT8.coerce\_value](index.html#document-reference/generated/methods/pandera.engines.pandas_engine.UINT8.coerce_value)

		+ [pandera.engines.pandas\_engine.UINT8.try\_coerce](index.html#document-reference/generated/methods/pandera.engines.pandas_engine.UINT8.try_coerce)

		+ [pandera.engines.pandas\_engine.UINT8.\_\_call\_\_](index.html#document-reference/generated/methods/pandera.engines.pandas_engine.UINT8.__call__)

	* [pandera.engines.pandas\_engine.UINT16](index.html#document-reference/generated/pandera.engines.pandas_engine.UINT16)Toggle child pages in navigation

		+ [pandera.engines.pandas\_engine.UINT16.\_\_init\_\_](index.html#document-reference/generated/methods/pandera.engines.pandas_engine.UINT16.__init__)

		+ [pandera.engines.pandas\_engine.UINT16.check](index.html#document-reference/generated/methods/pandera.engines.pandas_engine.UINT16.check)

		+ [pandera.engines.pandas\_engine.UINT16.coerce](index.html#document-reference/generated/methods/pandera.engines.pandas_engine.UINT16.coerce)

		+ [pandera.engines.pandas\_engine.UINT16.coerce\_value](index.html#document-reference/generated/methods/pandera.engines.pandas_engine.UINT16.coerce_value)

		+ [pandera.engines.pandas\_engine.UINT16.try\_coerce](index.html#document-reference/generated/methods/pandera.engines.pandas_engine.UINT16.try_coerce)

		+ [pandera.engines.pandas\_engine.UINT16.\_\_call\_\_](index.html#document-reference/generated/methods/pandera.engines.pandas_engine.UINT16.__call__)

	* [pandera.engines.pandas\_engine.UINT32](index.html#document-reference/generated/pandera.engines.pandas_engine.UINT32)Toggle child pages in navigation

		+ [pandera.engines.pandas\_engine.UINT32.\_\_init\_\_](index.html#document-reference/generated/methods/pandera.engines.pandas_engine.UINT32.__init__)

		+ [pandera.engines.pandas\_engine.UINT32.check](index.html#document-reference/generated/methods/pandera.engines.pandas_engine.UINT32.check)

		+ [pandera.engines.pandas\_engine.UINT32.coerce](index.html#document-reference/generated/methods/pandera.engines.pandas_engine.UINT32.coerce)

		+ [pandera.engines.pandas\_engine.UINT32.coerce\_value](index.html#document-reference/generated/methods/pandera.engines.pandas_engine.UINT32.coerce_value)

		+ [pandera.engines.pandas\_engine.UINT32.try\_coerce](index.html#document-reference/generated/methods/pandera.engines.pandas_engine.UINT32.try_coerce)

		+ [pandera.engines.pandas\_engine.UINT32.\_\_call\_\_](index.html#document-reference/generated/methods/pandera.engines.pandas_engine.UINT32.__call__)

	* [pandera.engines.pandas\_engine.UINT64](index.html#document-reference/generated/pandera.engines.pandas_engine.UINT64)Toggle child pages in navigation

		+ [pandera.engines.pandas\_engine.UINT64.\_\_init\_\_](index.html#document-reference/generated/methods/pandera.engines.pandas_engine.UINT64.__init__)

		+ [pandera.engines.pandas\_engine.UINT64.check](index.html#document-reference/generated/methods/pandera.engines.pandas_engine.UINT64.check)

		+ [pandera.engines.pandas\_engine.UINT64.coerce](index.html#document-reference/generated/methods/pandera.engines.pandas_engine.UINT64.coerce)

		+ [pandera.engines.pandas\_engine.UINT64.coerce\_value](index.html#document-reference/generated/methods/pandera.engines.pandas_engine.UINT64.coerce_value)

		+ [pandera.engines.pandas\_engine.UINT64.try\_coerce](index.html#document-reference/generated/methods/pandera.engines.pandas_engine.UINT64.try_coerce)

		+ [pandera.engines.pandas\_engine.UINT64.\_\_call\_\_](index.html#document-reference/generated/methods/pandera.engines.pandas_engine.UINT64.__call__)

	* [pandera.engines.pandas\_engine.STRING](index.html#document-reference/generated/pandera.engines.pandas_engine.STRING)Toggle child pages in navigation

		+ [pandera.engines.pandas\_engine.STRING.\_\_init\_\_](index.html#document-reference/generated/methods/pandera.engines.pandas_engine.STRING.__init__)

		+ [pandera.engines.pandas\_engine.STRING.check](index.html#document-reference/generated/methods/pandera.engines.pandas_engine.STRING.check)

		+ [pandera.engines.pandas\_engine.STRING.coerce](index.html#document-reference/generated/methods/pandera.engines.pandas_engine.STRING.coerce)

		+ [pandera.engines.pandas\_engine.STRING.coerce\_value](index.html#document-reference/generated/methods/pandera.engines.pandas_engine.STRING.coerce_value)

		+ [pandera.engines.pandas\_engine.STRING.from\_parametrized\_dtype](index.html#document-reference/generated/methods/pandera.engines.pandas_engine.STRING.from_parametrized_dtype)

		+ [pandera.engines.pandas\_engine.STRING.try\_coerce](index.html#document-reference/generated/methods/pandera.engines.pandas_engine.STRING.try_coerce)

		+ [pandera.engines.pandas\_engine.STRING.\_\_call\_\_](index.html#document-reference/generated/methods/pandera.engines.pandas_engine.STRING.__call__)

	* [pandera.engines.numpy\_engine.Object](index.html#document-reference/generated/pandera.engines.numpy_engine.Object)Toggle child pages in navigation

		+ [pandera.engines.numpy\_engine.Object.\_\_init\_\_](index.html#document-reference/generated/methods/pandera.engines.numpy_engine.Object.__init__)

		+ [pandera.engines.numpy\_engine.Object.check](index.html#document-reference/generated/methods/pandera.engines.numpy_engine.Object.check)

		+ [pandera.engines.numpy\_engine.Object.coerce](index.html#document-reference/generated/methods/pandera.engines.numpy_engine.Object.coerce)

		+ [pandera.engines.numpy\_engine.Object.coerce\_value](index.html#document-reference/generated/methods/pandera.engines.numpy_engine.Object.coerce_value)

		+ [pandera.engines.numpy\_engine.Object.try\_coerce](index.html#document-reference/generated/methods/pandera.engines.numpy_engine.Object.try_coerce)

		+ [pandera.engines.numpy\_engine.Object.\_\_call\_\_](index.html#document-reference/generated/methods/pandera.engines.numpy_engine.Object.__call__)

	* [pandera.engines.pandas\_engine.DateTime](index.html#document-reference/generated/pandera.engines.pandas_engine.DateTime)

	* [pandera.engines.pandas\_engine.Date](index.html#document-reference/generated/pandera.engines.pandas_engine.Date)Toggle child pages in navigation

		+ [pandera.engines.pandas\_engine.Date.\_\_init\_\_](index.html#document-reference/generated/methods/pandera.engines.pandas_engine.Date.__init__)

		+ [pandera.engines.pandas\_engine.Date.check](index.html#document-reference/generated/methods/pandera.engines.pandas_engine.Date.check)

		+ [pandera.engines.pandas\_engine.Date.coerce](index.html#document-reference/generated/methods/pandera.engines.pandas_engine.Date.coerce)

		+ [pandera.engines.pandas\_engine.Date.coerce\_value](index.html#document-reference/generated/methods/pandera.engines.pandas_engine.Date.coerce_value)

		+ [pandera.engines.pandas\_engine.Date.try\_coerce](index.html#document-reference/generated/methods/pandera.engines.pandas_engine.Date.try_coerce)

		+ [pandera.engines.pandas\_engine.Date.\_\_call\_\_](index.html#document-reference/generated/methods/pandera.engines.pandas_engine.Date.__call__)

	* [pandera.engines.pandas\_engine.Decimal](index.html#document-reference/generated/pandera.engines.pandas_engine.Decimal)Toggle child pages in navigation

		+ [pandera.engines.pandas\_engine.Decimal.\_\_init\_\_](index.html#document-reference/generated/methods/pandera.engines.pandas_engine.Decimal.__init__)

		+ [pandera.engines.pandas\_engine.Decimal.check](index.html#document-reference/generated/methods/pandera.engines.pandas_engine.Decimal.check)

		+ [pandera.engines.pandas\_engine.Decimal.coerce](index.html#document-reference/generated/methods/pandera.engines.pandas_engine.Decimal.coerce)

		+ [pandera.engines.pandas\_engine.Decimal.coerce\_value](index.html#document-reference/generated/methods/pandera.engines.pandas_engine.Decimal.coerce_value)

		+ [pandera.engines.pandas\_engine.Decimal.try\_coerce](index.html#document-reference/generated/methods/pandera.engines.pandas_engine.Decimal.try_coerce)

		+ [pandera.engines.pandas\_engine.Decimal.\_\_call\_\_](index.html#document-reference/generated/methods/pandera.engines.pandas_engine.Decimal.__call__)

	* [pandera.engines.pandas\_engine.Category](index.html#document-reference/generated/pandera.engines.pandas_engine.Category)Toggle child pages in navigation

		+ [pandera.engines.pandas\_engine.Category.\_\_init\_\_](index.html#document-reference/generated/methods/pandera.engines.pandas_engine.Category.__init__)

		+ [pandera.engines.pandas\_engine.Category.check](index.html#document-reference/generated/methods/pandera.engines.pandas_engine.Category.check)

		+ [pandera.engines.pandas\_engine.Category.coerce](index.html#document-reference/generated/methods/pandera.engines.pandas_engine.Category.coerce)

		+ [pandera.engines.pandas\_engine.Category.coerce\_value](index.html#document-reference/generated/methods/pandera.engines.pandas_engine.Category.coerce_value)

		+ [pandera.engines.pandas\_engine.Category.from\_parametrized\_dtype](index.html#document-reference/generated/methods/pandera.engines.pandas_engine.Category.from_parametrized_dtype)

		+ [pandera.engines.pandas\_engine.Category.try\_coerce](index.html#document-reference/generated/methods/pandera.engines.pandas_engine.Category.try_coerce)

		+ [pandera.engines.pandas\_engine.Category.\_\_call\_\_](index.html#document-reference/generated/methods/pandera.engines.pandas_engine.Category.__call__)

	* [pandera.engines.pandas\_engine.Geometry](index.html#document-reference/generated/pandera.engines.pandas_engine.Geometry)Toggle child pages in navigation

		+ [pandera.engines.pandas\_engine.Geometry.\_\_init\_\_](index.html#document-reference/generated/methods/pandera.engines.pandas_engine.Geometry.__init__)

		+ [pandera.engines.pandas\_engine.Geometry.check](index.html#document-reference/generated/methods/pandera.engines.pandas_engine.Geometry.check)

		+ [pandera.engines.pandas\_engine.Geometry.coerce](index.html#document-reference/generated/methods/pandera.engines.pandas_engine.Geometry.coerce)

		+ [pandera.engines.pandas\_engine.Geometry.coerce\_value](index.html#document-reference/generated/methods/pandera.engines.pandas_engine.Geometry.coerce_value)

		+ [pandera.engines.pandas\_engine.Geometry.try\_coerce](index.html#document-reference/generated/methods/pandera.engines.pandas_engine.Geometry.try_coerce)

		+ [pandera.engines.pandas\_engine.Geometry.\_\_call\_\_](index.html#document-reference/generated/methods/pandera.engines.pandas_engine.Geometry.__call__)

	* [pandera.engines.pandas\_engine.PydanticModel](index.html#document-reference/generated/pandera.engines.pandas_engine.PydanticModel)Toggle child pages in navigation

		+ [pandera.engines.pandas\_engine.PydanticModel.\_\_init\_\_](index.html#document-reference/generated/methods/pandera.engines.pandas_engine.PydanticModel.__init__)

		+ [pandera.engines.pandas\_engine.PydanticModel.check](index.html#document-reference/generated/methods/pandera.engines.pandas_engine.PydanticModel.check)

		+ [pandera.engines.pandas\_engine.PydanticModel.coerce](index.html#document-reference/generated/methods/pandera.engines.pandas_engine.PydanticModel.coerce)

		+ [pandera.engines.pandas\_engine.PydanticModel.coerce\_value](index.html#document-reference/generated/methods/pandera.engines.pandas_engine.PydanticModel.coerce_value)

		+ [pandera.engines.pandas\_engine.PydanticModel.try\_coerce](index.html#document-reference/generated/methods/pandera.engines.pandas_engine.PydanticModel.try_coerce)

		+ [pandera.engines.pandas\_engine.PydanticModel.\_\_call\_\_](index.html#document-reference/generated/methods/pandera.engines.pandas_engine.PydanticModel.__call__)

	* [pandera.dtypes.is\_subdtype](index.html#document-reference/generated/pandera.dtypes.is_subdtype)

	* [pandera.dtypes.is\_float](index.html#document-reference/generated/pandera.dtypes.is_float)

	* [pandera.dtypes.is\_int](index.html#document-reference/generated/pandera.dtypes.is_int)

	* [pandera.dtypes.is\_uint](index.html#document-reference/generated/pandera.dtypes.is_uint)

	* [pandera.dtypes.is\_complex](index.html#document-reference/generated/pandera.dtypes.is_complex)

	* [pandera.dtypes.is\_numeric](index.html#document-reference/generated/pandera.dtypes.is_numeric)

	* [pandera.dtypes.is\_bool](index.html#document-reference/generated/pandera.dtypes.is_bool)

	* [pandera.dtypes.is\_string](index.html#document-reference/generated/pandera.dtypes.is_string)

	* [pandera.dtypes.is\_datetime](index.html#document-reference/generated/pandera.dtypes.is_datetime)

	* [pandera.dtypes.is\_timedelta](index.html#document-reference/generated/pandera.dtypes.is_timedelta)

	* [pandera.dtypes.immutable](index.html#document-reference/generated/pandera.dtypes.immutable)

	* [pandera.engines.engine.Engine](index.html#document-reference/generated/pandera.engines.engine.Engine)Toggle child pages in navigation

		+ [pandera.engines.engine.Engine.dtype](index.html#document-reference/generated/methods/pandera.engines.engine.Engine.dtype)

		+ [pandera.engines.engine.Engine.get\_registered\_dtypes](index.html#document-reference/generated/methods/pandera.engines.engine.Engine.get_registered_dtypes)

		+ [pandera.engines.engine.Engine.register\_dtype](index.html#document-reference/generated/methods/pandera.engines.engine.Engine.register_dtype)

		+ [pandera.engines.engine.Engine.\_\_call\_\_](index.html#document-reference/generated/methods/pandera.engines.engine.Engine.__call__)

	* [pandera.engines.numpy\_engine.Engine](index.html#document-reference/generated/pandera.engines.numpy_engine.Engine)Toggle child pages in navigation

		+ [pandera.engines.numpy\_engine.Engine.dtype](index.html#document-reference/generated/methods/pandera.engines.numpy_engine.Engine.dtype)

	* [pandera.engines.pandas\_engine.Engine](index.html#document-reference/generated/pandera.engines.pandas_engine.Engine)Toggle child pages in navigation

		+ [pandera.engines.pandas\_engine.Engine.dtype](index.html#document-reference/generated/methods/pandera.engines.pandas_engine.Engine.dtype)

		+ [pandera.engines.pandas\_engine.Engine.numpy\_dtype](index.html#document-reference/generated/methods/pandera.engines.pandas_engine.Engine.numpy_dtype)

- [Schema Models](index.html#document-reference/schema_models)Toggle child pages in navigation

	* [pandera.model.SchemaModel](index.html#document-reference/generated/pandera.model.SchemaModel)Toggle child pages in navigation

		+ [pandera.model.SchemaModel.example](index.html#document-reference/generated/methods/pandera.model.SchemaModel.example)

		+ [pandera.model.SchemaModel.strategy](index.html#document-reference/generated/methods/pandera.model.SchemaModel.strategy)

		+ [pandera.model.SchemaModel.to\_schema](index.html#document-reference/generated/methods/pandera.model.SchemaModel.to_schema)

		+ [pandera.model.SchemaModel.to\_yaml](index.html#document-reference/generated/methods/pandera.model.SchemaModel.to_yaml)

		+ [pandera.model.SchemaModel.validate](index.html#document-reference/generated/methods/pandera.model.SchemaModel.validate)

	* [pandera.model\_components.Field](index.html#document-reference/generated/pandera.model_components.Field)

	* [pandera.model\_components.check](index.html#document-reference/generated/pandera.model_components.check)

	* [pandera.model\_components.dataframe\_check](index.html#document-reference/generated/pandera.model_components.dataframe_check)

	* [pandera.typing](index.html#document-reference/generated/pandera.typing)Toggle child pages in navigation

		+ [pandera.typing.fastapi.UploadFile](index.html#document-reference/generated/generated/pandera.typing.fastapi.UploadFile)Toggle child pages in navigation

			- [pandera.typing.fastapi.UploadFile.\_\_init\_\_](index.html#document-reference/generated/generated/methods/pandera.typing.fastapi.UploadFile.__init__)

			- [pandera.typing.fastapi.UploadFile.pydantic\_validate](index.html#document-reference/generated/generated/methods/pandera.typing.fastapi.UploadFile.pydantic_validate)

		+ [pandera.typing.formats.Formats](index.html#document-reference/generated/generated/pandera.typing.formats.Formats)

	* [pandera.model.BaseConfig](index.html#document-reference/generated/pandera.model.BaseConfig)

- [Decorators](index.html#document-reference/decorators)Toggle child pages in navigation

	* [pandera.decorators.check\_input](index.html#document-reference/generated/pandera.decorators.check_input)

	* [pandera.decorators.check\_output](index.html#document-reference/generated/pandera.decorators.check_output)

	* [pandera.decorators.check\_io](index.html#document-reference/generated/pandera.decorators.check_io)

	* [pandera.decorators.check\_types](index.html#document-reference/generated/pandera.decorators.check_types)

- [Schema Inference](index.html#document-reference/schema_inference)Toggle child pages in navigation

	* [pandera.schema\_inference.infer\_schema](index.html#document-reference/generated/pandera.schema_inference.infer_schema)

- [IO Utilities](index.html#document-reference/io)Toggle child pages in navigation

	* [pandera.io.from\_yaml](index.html#document-reference/generated/pandera.io.from_yaml)

	* [pandera.io.to\_yaml](index.html#document-reference/generated/pandera.io.to_yaml)

	* [pandera.io.to\_script](index.html#document-reference/generated/pandera.io.to_script)

- [Data Synthesis Strategies](index.html#document-reference/strategies)Toggle child pages in navigation

	* [pandera.strategies](index.html#document-reference/generated/pandera.strategies)

- [Extensions](index.html#document-reference/extensions)Toggle child pages in navigation

	* [pandera.extensions](index.html#document-reference/generated/pandera.extensions)

- [Errors](index.html#document-reference/errors)Toggle child pages in navigation

	* [pandera.errors.SchemaError](index.html#document-reference/generated/pandera.errors.SchemaError)

	* [pandera.errors.SchemaErrors](index.html#document-reference/generated/pandera.errors.SchemaErrors)

	* [pandera.errors.SchemaInitError](index.html#document-reference/generated/pandera.errors.SchemaInitError)

	* [pandera.errors.SchemaDefinitionError](index.html#document-reference/generated/pandera.errors.SchemaDefinitionError)

Community

* [Contributing](index.html#document-CONTRIBUTING)

[Back to top](#)

Toggle Light / Dark / Auto color theme

Toggle table of contents sidebar

A Statistical Data Testing Toolkit[#](#a-statistical-data-testing-toolkit "Permalink to this headline")

=======================================================================================================

*A data validation library for scientists, engineers, and analysts seeking

correctness.*

[![CI Build](https://github.com/pandera-dev/pandera/workflows/CI%20Tests/badge.svg?branch=master)](https://github.com/pandera-dev/pandera/actions?query=workflow%3A%22CI+Tests%22+branch%3Amaster)

[![Documentation Stable Status](https://readthedocs.org/projects/pandera/badge/?version=stable)](https://pandera.readthedocs.io/en/stable/?badge=stable)

[![pypi](https://img.shields.io/pypi/v/pandera.svg)](https://pypi.org/project/pandera/)

[![pypi versions](https://img.shields.io/pypi/l/pandera.svg)](https://pypi.python.org/pypi/)

[![pyOpenSci Review](https://tinyurl.com/y22nb8up)](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://www.repostatus.org/badges/latest/active.svg)](https://www.repostatus.org/#active)

[![Documentation Latest Status](https://readthedocs.org/projects/pandera/badge/?version=latest)](https://pandera.readthedocs.io/en/stable/?badge=latest)

[![Code Coverage](https://codecov.io/gh/unionai-oss/pandera/branch/master/graph/badge.svg)](https://codecov.io/gh/unionai-oss/pandera)

[![PyPI pyversions](https://img.shields.io/pypi/pyversions/pandera.svg)](https://pypi.python.org/pypi/pandera/)

[![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.3385265.svg)](https://doi.org/10.5281/zenodo.3385265)

[![asv](http://img.shields.io/badge/benchmarked%20by-asv-green.svg?style=flat)](https://pandera-dev.github.io/pandera-asv-logs/)

[![Monthly Downloads](https://pepy.tech/badge/pandera/month)](https://pepy.tech/project/pandera)

[![Total Downloads](https://pepy.tech/badge/pandera)](https://pepy.tech/badge/pandera)

[![Conda Downloads](https://img.shields.io/conda/dn/conda-forge/pandera?label=conda%20downloads)](https://anaconda.org/conda-forge/pandera)

[![Discord Community](https://img.shields.io/badge/discord-chat-purple?color=%235765F2&label=discord&logo=discord)](https://discord.gg/vyanhWuaKB)

  

`pandera` provides a flexible and expressive API for performing data

validation on dataframe-like objects to make data processing pipelines more

readable and robust.

Dataframes contain information that `pandera` explicitly validates at runtime.

This is useful in production-critical data pipelines or reproducible research

settings. With `pandera`, you can:

1. Define a schema once and use it to validate [different dataframe types](index.html#supported-dataframe-libraries)

including [pandas](http://pandas.pydata.org), [dask](https://dask.org/),

[modin](https://modin.readthedocs.io/), and

[pyspark.pandas](https://spark.apache.org/docs/3.2.0/api/python/user_guide/pandas_on_spark/index.html).

2. [Check](index.html#checks) the types and properties of columns in a

`pd.DataFrame` or values in a `pd.Series`.

3. Perform more complex statistical validation like

[hypothesis testing](index.html#hypothesis).

4. Seamlessly integrate with existing data analysis/processing pipelines

via [function decorators](index.html#decorators).

5. Define schema models with the [class-based API](index.html#schema-models) with

pydantic-style syntax and validate dataframes using the typing syntax.

6. [Synthesize data](index.html#data-synthesis-strategies) from schema objects for

property-based testing with pandas data structures.

7. [Lazily Validate](index.html#lazy-validation) dataframes so that all validation

rules are executed before raising an error.

8. [Integrate](index.html#integrations) with a rich ecosystem of python tools like

[pydantic](https://pydantic-docs.helpmanual.io/),

[fastapi](https://fastapi.tiangolo.com/) and [mypy](http://mypy-lang.org/).

Install[#](#install "Permalink to this headline")

-------------------------------------------------

Install with `pip`:

```

pip install pandera

```

Or `conda`:

```

conda install -c conda-forge pandera

```

### Extras[#](#extras "Permalink to this headline")

Installing additional functionality:

pip

```

pip install pandera[hypotheses]  # hypothesis checks

pip install pandera[io]          # yaml/script schema io utilities

pip install pandera[strategies]  # data synthesis strategies

pip install pandera[mypy]        # enable static type-linting of pandas

pip install pandera[fastapi]     # fastapi integration

pip install pandera[dask]        # validate dask dataframes

pip install pandera[pyspark]     # validate pyspark dataframes

pip install pandera[modin]       # validate modin dataframes

pip install pandera[modin-ray]   # validate modin dataframes with ray

pip install pandera[modin-dask]  # validate modin dataframes with dask

pip install pandera[geopandas]   # validate geopandas geodataframes

```

conda

```

conda install -c conda-forge pandera-hypotheses  # hypothesis checks

conda install -c conda-forge pandera-io          # yaml/script schema io utilities

conda install -c conda-forge pandera-strategies  # data synthesis strategies

conda install -c conda-forge pandera-mypy        # enable static type-linting of pandas

conda install -c conda-forge pandera-fastapi     # fastapi integration

conda install -c conda-forge pandera-dask        # validate dask dataframes

conda install -c conda-forge pandera-pyspark     # validate pyspark dataframes

conda install -c conda-forge pandera-modin       # validate modin dataframes

conda install -c conda-forge pandera-modin-ray   # validate modin dataframes with ray

conda install -c conda-forge pandera-modin-dask  # validate modin dataframes with dask

conda install -c conda-forge pandera-geopandas   # validate geopandas geodataframes

```

Quick Start[#](#quick-start "Permalink to this headline")

---------------------------------------------------------

```

import pandas as pd

import pandera as pa

# data to validate

df = pd.DataFrame({

    "column1": [1, 4, 0, 10, 9],

    "column2": [-1.3, -1.4, -2.9, -10.1, -20.4],

    "column3": ["value\_1", "value\_2", "value\_3", "value\_2", "value\_1"],

})

# define schema

schema = pa.DataFrameSchema({

    "column1": pa.Column(int, checks=pa.Check.le(10)),

    "column2": pa.Column(float, checks=pa.Check.lt(-1.2)),

    "column3": pa.Column(str, checks=[

        pa.Check.str\_startswith("value\_"),

        # define custom checks as functions that take a series as input and

        # outputs a boolean or boolean Series

        pa.Check(lambda s: s.str.split("\_", expand=True).shape[1] == 2)

    ]),

})

validated\_df = schema(df)

print(validated\_df)

```

```

   column1  column2  column3

0        1     -1.3  value_1

1        4     -1.4  value_2

2        0     -2.9  value_3

3       10    -10.1  value_2

4        9    -20.4  value_1

```

You can pass the built-in python types that are supported by

pandas, or strings representing the

[legal pandas datatypes](https://pandas.pydata.org/docs/user_guide/basics.html#dtypes),

or pandera’s `DataType`:

```

schema = pa.DataFrameSchema({

    # built-in python types

    "int\_column": pa.Column(int),

    "float\_column": pa.Column(float),

    "str\_column": pa.Column(str),

    # pandas dtype string aliases

    "int\_column2": pa.Column("int64"),

    "float\_column2": pa.Column("float64"),

    # pandas > 1.0.0 support native "string" type

    "str\_column2": pa.Column("str"),

    # pandera DataType

    "int\_column3": pa.Column(pa.Int),

    "float\_column3": pa.Column(pa.Float),

    "str\_column3": pa.Column(pa.String),

})

```

For more details on data types, see [`DataType`](index.html#pandera.dtypes.DataType "pandera.dtypes.DataType")

Schema Model[#](#schema-model "Permalink to this headline")

-----------------------------------------------------------

`pandera` also provides an alternative API for expressing schemas inspired

by [dataclasses](https://docs.python.org/3/library/dataclasses.html) and

[pydantic](https://pydantic-docs.helpmanual.io/). The equivalent

[`SchemaModel`](index.html#pandera.model.SchemaModel "pandera.model.SchemaModel") for the above

`DataFrameSchema` would be:

```

from pandera.typing import Series

class Schema(pa.SchemaModel):

    column1: Series[int] = pa.Field(le=10)

    column2: Series[float] = pa.Field(lt=-1.2)

    column3: Series[str] = pa.Field(str\_startswith="value\_")

    @pa.check("column3")

    def column\_3\_check(cls, series: Series[str]) -> Series[bool]:

        """Check that column3 values have two elements after being split with '\_'"""

        return series.str.split("\_", expand=True).shape[1] == 2

Schema.validate(df)

```

Informative Errors[#](#informative-errors "Permalink to this headline")

-----------------------------------------------------------------------

If the dataframe does not pass validation checks, `pandera` provides

useful error messages. An `error` argument can also be supplied to

`Check` for custom error messages.

In the case that a validation `Check` is violated:

```

import pandas as pd

from pandera import Column, DataFrameSchema, Int, Check

simple\_schema = DataFrameSchema({

    "column1": Column(

        Int, Check(lambda x: 0 <= x <= 10, element\_wise=True,

                   error="range checker [0, 10]"))

})

# validation rule violated

fail\_check\_df = pd.DataFrame({

    "column1": [-20, 5, 10, 30],

})

simple\_schema(fail\_check\_df)

```

```

Traceback (most recent call last):

...

SchemaError: <Schema Column: 'column1' type=<class 'int'>> failed element-wise validator 0:

<Check <lambda>: range checker [0, 10]>

failure cases:

   index  failure_case

0      0           -20

1      3            30

```

And in the case of a mis-specified column name:

```

# column name mis-specified

wrong\_column\_df = pd.DataFrame({

   "foo": ["bar"] \* 10,

   "baz": [1] \* 10

})

simple\_schema.validate(wrong\_column\_df)

```

```

Traceback (most recent call last):

...

pandera.SchemaError: column 'column1' not in dataframe

   foo  baz

0  bar    1

1  bar    1

2  bar    1

3  bar    1

4  bar    1

```

Contributing[#](#contributing "Permalink to this headline")

-----------------------------------------------------------

All contributions, bug reports, bug fixes, documentation improvements,

enhancements and ideas are welcome.

A detailed overview on how to contribute can be found in the

[contributing

guide](https://github.com/pandera-dev/pandera/blob/master/.github/CONTRIBUTING.md)

on GitHub.

Issues[#](#issues "Permalink to this headline")

-----------------------------------------------

Submit issues, feature requests or bugfixes on

[github](https://github.com/pandera-dev/pandera/issues).

Need Help?[#](#need-help "Permalink to this headline")

------------------------------------------------------

There are many ways of getting help with your questions. You can ask a question

on [Github Discussions](https://github.com/pandera-dev/pandera/discussions/categories/q-a)

page or reach out to the maintainers and pandera community on

[Discord](https://discord.gg/vyanhWuaKB)

### Try Pandera[#](#try-pandera "Permalink to this headline")

Tip

You can access the full screen jupyter notebook environment [here](lite/retro/notebooks/?path=try_pandera.ipynb).

### DataFrame Schemas[#](#dataframe-schemas "Permalink to this headline")

The [`DataFrameSchema`](index.html#pandera.schemas.DataFrameSchema "pandera.schemas.DataFrameSchema") class enables the specification of a schema

that verifies the columns and index of a pandas `DataFrame` object.

The [`DataFrameSchema`](index.html#pandera.schemas.DataFrameSchema "pandera.schemas.DataFrameSchema") object consists of [`Column`](#column)s and an [`Index`](#index).

```

import pandera as pa

from pandera import Column, DataFrameSchema, Check, Index

schema = DataFrameSchema(

    {

        "column1": Column(int),

        "column2": Column(float, Check(lambda s: s < -1.2)),

        # you can provide a list of validators

        "column3": Column(str, [

           Check(lambda s: s.str.startswith("value")),

           Check(lambda s: s.str.split("\_", expand=True).shape[1] == 2)

        ]),

    },

    index=Index(int),

    strict=True,

    coerce=True,

)

```

You can refer to [Schema Models](index.html#schema-models) to see how to define dataframe schemas

using the alternative pydantic/dataclass-style syntax.

#### Column Validation[#](#column-validation "Permalink to this headline")

A [`Column`](index.html#pandera.schema_components.Column "pandera.schema_components.Column") must specify the properties of a

column in a dataframe object. It can be optionally verified for its data type,

[null values](#null-values) or

duplicate values. The column can be [coerced](#coerced) into the specified type, and the

[required](#required) parameter allows control over whether or not the column is allowed to

be missing.

Similarly to pandas, the data type can be specified as:

* a string alias, as long as it is recognized by pandas.

* a python type: int, float, double, bool, str

* a [numpy data type](https://numpy.org/doc/stable/user/basics.types.html)

* a [pandas extension type](https://pandas.pydata.org/pandas-docs/stable/user_guide/basics.html#dtypes):

it can be an instance (e.g pd.CategoricalDtype([“a”, “b”])) or a

class (e.g pandas.CategoricalDtype) if it can be initialized with default

values.

* a pandera [`DataType`](index.html#pandera.dtypes.DataType "pandera.dtypes.DataType"): it can also be an instance or a

class.

[Column checks](index.html#checks) allow for the DataFrame’s values to be

checked against a user-provided function. `Check` objects also support

[grouping](index.html#grouping) by a different column so that the user can make

assertions about subsets of the column of interest.

Column Hypotheses enable you to perform statistical hypothesis tests on a

DataFrame in either wide or tidy format. See

[Hypothesis Testing](index.html#hypothesis) for more details.

##### Null Values in Columns[#](#null-values-in-columns "Permalink to this headline")

By default, SeriesSchema/Column objects assume that values are not

nullable. In order to accept null values, you need to explicitly specify

`nullable=True`, or else you’ll get an error.

```

import numpy as np

import pandas as pd

import pandera as pa

from pandera import Check, Column, DataFrameSchema

df = pd.DataFrame({"column1": [5, 1, np.nan]})

non\_null\_schema = DataFrameSchema({

    "column1": Column(float, Check(lambda x: x > 0))

})

non\_null\_schema.validate(df)

```

```

Traceback (most recent call last):

...

SchemaError: non-nullable series contains null values: {2: nan}

```

```

null\_schema = DataFrameSchema({

    "column1": Column(float, Check(lambda x: x > 0), nullable=True)

})

print(null\_schema.validate(df))

```

```

   column1

0      5.0

1      1.0

2      NaN

```

##### Coercing Types on Columns[#](#coercing-types-on-columns "Permalink to this headline")

If you specify `Column(dtype, ..., coerce=True)` as part of the

DataFrameSchema definition, calling `schema.validate` will first

coerce the column into the specified `dtype` before applying validation

checks.

```

import pandas as pd

import pandera as pa

from pandera import Column, DataFrameSchema

df = pd.DataFrame({"column1": [1, 2, 3]})

schema = DataFrameSchema({"column1": Column(str, coerce=True)})

validated\_df = schema.validate(df)

assert isinstance(validated\_df.column1.iloc[0], str)

```

Note

Note the special case of integers columns not supporting `nan`

values. In this case, `schema.validate` will complain if `coerce == True`

and null values are allowed in the column.

```

df = pd.DataFrame({"column1": [1., 2., 3, np.nan]})

schema = DataFrameSchema({

    "column1": Column(int, coerce=True, nullable=True)

})

validated\_df = schema.validate(df)

```

```

Traceback (most recent call last):

...

pandera.errors.SchemaError: Error while coercing 'column1' to type int64: Cannot convert non-finite values (NA or inf) to integer

```

The best way to handle this case is to simply specify the column as a

`Float` or `Object`.

```

schema\_object = DataFrameSchema({

    "column1": Column(object, coerce=True, nullable=True)

})

schema\_float = DataFrameSchema({

    "column1": Column(float, coerce=True, nullable=True)

})

print(schema\_object.validate(df).dtypes)

print(schema\_float.validate(df).dtypes)

```

```

column1    object

dtype: object

column1    float64

dtype: object

```

If you want to coerce all of the columns specified in the

`DataFrameSchema`, you can specify the `coerce` argument with

`DataFrameSchema(..., coerce=True)`.

##### Required Columns[#](#required-columns "Permalink to this headline")

By default all columns specified in the schema are required, meaning

that if a column is missing in the input DataFrame an exception will be

thrown. If you want to make a column optional, specify `required=False`

in the column constructor:

```

import pandas as pd

import pandera as pa

from pandera import Column, DataFrameSchema

df = pd.DataFrame({"column2": ["hello", "pandera"]})

schema = DataFrameSchema({

    "column1": Column(int, required=False),

    "column2": Column(str)

})

validated\_df = schema.validate(df)

print(validated\_df)

```

```

   column2

0    hello

1  pandera

```

Since `required=True` by default, missing columns would raise an error:

```

schema = DataFrameSchema({

    "column1": Column(int),

    "column2": Column(str),

})

schema.validate(df)

```

```

Traceback (most recent call last):

...

pandera.SchemaError: column 'column1' not in dataframe

   column2

0    hello

1  pandera

```

##### Ordered Columns[#](#ordered-columns "Permalink to this headline")

##### Stand-alone Column Validation[#](#stand-alone-column-validation "Permalink to this headline")

In addition to being used in the context of a `DataFrameSchema`, `Column`

objects can also be used to validate columns in a dataframe on its own:

```

import pandas as pd

import pandera as pa

df = pd.DataFrame({

    "column1": [1, 2, 3],

    "column2": ["a", "b", "c"],

})

column1\_schema = pa.Column(int, name="column1")

column2\_schema = pa.Column(str, name="column2")

# pass the dataframe as an argument to the Column object callable

df = column1\_schema(df)

validated\_df = column2\_schema(df)

# or explicitly use the validate method

df = column1\_schema.validate(df)

validated\_df = column2\_schema.validate(df)

# use the DataFrame.pipe method to validate two columns

validated\_df = df.pipe(column1\_schema).pipe(column2\_schema)

```

For multi-column use cases, the [`DataFrameSchema`](index.html#pandera.schemas.DataFrameSchema "pandera.schemas.DataFrameSchema") is still recommended, but

if you have one or a small number of columns to verify, using `Column`

objects by themselves is appropriate.

##### Column Regex Pattern Matching[#](#column-regex-pattern-matching "Permalink to this headline")

In the case that your dataframe has multiple columns that share common

statistical properties, you might want to specify a regex pattern that matches

a set of meaningfully grouped columns that have `str` names.

```

import numpy as np

import pandas as pd

import pandera as pa

categories = ["A", "B", "C"]

np.random.seed(100)

dataframe = pd.DataFrame({

    "cat\_var\_1": np.random.choice(categories, size=100),

    "cat\_var\_2": np.random.choice(categories, size=100),

    "num\_var\_1": np.random.uniform(0, 10, size=100),

    "num\_var\_2": np.random.uniform(20, 30, size=100),

})

schema = pa.DataFrameSchema({

    "num\_var\_.+": pa.Column(

        float,

        checks=pa.Check.greater\_than\_or\_equal\_to(0),

        regex=True,

    ),

    "cat\_var\_.+": pa.Column(

        pa.Category,

        checks=pa.Check.isin(categories),

        coerce=True,

        regex=True,

    ),

})

print(schema.validate(dataframe).head())

```

```

  cat_var_1 cat_var_2  num_var_1  num_var_2

0         A         A   6.804147  24.743304

1         A         C   3.684308  22.774633

2         A         C   5.911288  28.416588

3         C         A   4.790627  21.951250

4         C         B   4.504166  28.563142

```

You can also regex pattern match on `pd.MultiIndex` columns:

```

np.random.seed(100)

dataframe = pd.DataFrame({

    ("cat\_var\_1", "y1"): np.random.choice(categories, size=100),

    ("cat\_var\_2", "y2"): np.random.choice(categories, size=100),

    ("num\_var\_1", "x1"): np.random.uniform(0, 10, size=100),

    ("num\_var\_2", "x2"): np.random.uniform(0, 10, size=100),

})

schema = pa.DataFrameSchema({

    ("num\_var\_.+", "x.+"): pa.Column(

        float,

        checks=pa.Check.greater\_than\_or\_equal\_to(0),

        regex=True,

    ),

    ("cat\_var\_.+", "y.+"): pa.Column(

        pa.Category,

        checks=pa.Check.isin(categories),

        coerce=True,

        regex=True,

    ),

})

print(schema.validate(dataframe).head())

```

```

  cat_var_1 cat_var_2 num_var_1 num_var_2

         y1        y2        x1        x2

0         A         A  6.804147  4.743304

1         A         C  3.684308  2.774633

2         A         C  5.911288  8.416588

3         C         A  4.790627  1.951250

4         C         B  4.504166  8.563142

```

##### Handling Dataframe Columns not in the Schema[#](#handling-dataframe-columns-not-in-the-schema "Permalink to this headline")

By default, columns that aren’t specified in the schema aren’t checked.

If you want to check that the DataFrame *only* contains columns in the

schema, specify `strict=True`:

```

import pandas as pd

import pandera as pa

from pandera import Column, DataFrameSchema

schema = DataFrameSchema(

    {"column1": Column(int)},

    strict=True)

df = pd.DataFrame({"column2": [1, 2, 3]})

schema.validate(df)

```

```

Traceback (most recent call last):

...

SchemaError: column 'column2' not in DataFrameSchema {'column1': <Schema Column: 'None' type=DataType(int64)>}

```

Alternatively, if your DataFrame contains columns that are not in the schema,

and you would like these to be dropped on validation,

you can specify `strict='filter'`.

```

import pandas as pd

import pandera as pa

from pandera import Column, DataFrameSchema

df = pd.DataFrame({"column1": ["drop", "me"],"column2": ["keep", "me"]})

schema = DataFrameSchema({"column2": Column(str)}, strict='filter')

validated\_df = schema.validate(df)

print(validated\_df)

```

```

   column2

0     keep

1       me

```

##### Validating the order of the columns[#](#validating-the-order-of-the-columns "Permalink to this headline")

For some applications the order of the columns is important. For example:

* If you want to use

[selection by position](https://pandas.pydata.org/pandas-docs/stable/user_guide/10min.html#selection-by-position)

instead of the more common

[selection by label](https://pandas.pydata.org/pandas-docs/stable/user_guide/10min.html#selection-by-label).

* Machine learning: Many ML libraries will cast a Dataframe to numpy arrays,

for which order becomes crucial.

To validate the order of the Dataframe columns, specify `ordered=True`:

```

import pandas as pd

import pandera as pa

schema = pa.DataFrameSchema(

    columns={"a": pa.Column(int), "b": pa.Column(int)}, ordered=True

)

df = pd.DataFrame({"b": [1], "a": [1]})

print(schema.validate(df))

```

```

Traceback (most recent call last):

...

SchemaError: column 'b' out-of-order

```

##### Validating the joint uniqueness of columns[#](#validating-the-joint-uniqueness-of-columns "Permalink to this headline")

In some cases you might want to ensure that a group of columns are unique:

```

import pandas as pd

import pandera as pa

schema = pa.DataFrameSchema(

    columns={col: pa.Column(int) for col in ["a", "b", "c"]},

    unique=["a", "c"],

)

df = pd.DataFrame.from\_records([

    {"a": 1, "b": 2, "c": 3},

    {"a": 1, "b": 2, "c": 3},

])

schema.validate(df)

```

```

Traceback (most recent call last):

...

SchemaError: columns '('a', 'c')' not unique:

column  index  failure_case

0      a      0             1

1      a      1             1

2      c      0             3

3      c      1             3

```

To control how unique errors are reported, the report\_duplicates argument accepts:* exclude\_first: (default) report all duplicates except first occurence

* exclude\_last: report all duplicates except last occurence

* all: report all duplicates

```

import pandas as pd

import pandera as pa

schema = pa.DataFrameSchema(

    columns={col: pa.Column(int) for col in ["a", "b", "c"]},

    unique=["a", "c"],

    report\_duplicates = "exclude\_first",

)

df = pd.DataFrame.from\_records([

    {"a": 1, "b": 2, "c": 3},

    {"a": 1, "b": 2, "c": 3},

])

schema.validate(df)

```

```

Traceback (most recent call last):

...

SchemaError: columns '('a', 'c')' not unique:

column  index  failure_case

0      a      1             1

1      c      1             3

```

#### Index Validation[#](#index-validation "Permalink to this headline")

You can also specify an [`Index`](index.html#pandera.schema_components.Index "pandera.schema_components.Index") in the [`DataFrameSchema`](index.html#pandera.schemas.DataFrameSchema "pandera.schemas.DataFrameSchema").

```

import pandas as pd

import pandera as pa

from pandera import Column, DataFrameSchema, Index, Check

schema = DataFrameSchema(

   columns={"a": Column(int)},

   index=Index(

       str,

       Check(lambda x: x.str.startswith("index\_"))))

df = pd.DataFrame(

    data={"a": [1, 2, 3]},

    index=["index\_1", "index\_2", "index\_3"])

print(schema.validate(df))

```

```

         a

index_1  1

index_2  2

index_3  3

```

In the case that the DataFrame index doesn’t pass the `Check`.

```

df = pd.DataFrame(

    data={"a": [1, 2, 3]},

    index=["foo1", "foo2", "foo3"])

schema.validate(df)

```

```

Traceback (most recent call last):

...

SchemaError: <Schema Index> failed element-wise validator 0:

<lambda>

failure cases:

             index  count

failure_case

foo1           [0]      1

foo2           [1]      1

foo3           [2]      1

```

#### MultiIndex Validation[#](#multiindex-validation "Permalink to this headline")

`pandera` also supports multi-index column and index validation.

##### MultiIndex Columns[#](#multiindex-columns "Permalink to this headline")

Specifying multi-index columns follows the `pandas` syntax of specifying

tuples for each level in the index hierarchy:

```

import pandas as pd

import pandera as pa

from pandera import Column, DataFrameSchema, Index

schema = DataFrameSchema({

    ("foo", "bar"): Column(int),

    ("foo", "baz"): Column(str)

})

df = pd.DataFrame({

    ("foo", "bar"): [1, 2, 3],

    ("foo", "baz"): ["a", "b", "c"],

})

print(schema.validate(df))

```

```

  foo

  bar baz

0   1   a

1   2   b

2   3   c

```

##### MultiIndex Indexes[#](#multiindex-indexes "Permalink to this headline")

The [`MultiIndex`](index.html#pandera.schema_components.MultiIndex "pandera.schema_components.MultiIndex") class allows you to define multi-index

indexes by composing a list of `pandera.Index` objects.

```

import pandas as pd

import pandera as pa

from pandera import Column, DataFrameSchema, Index, MultiIndex, Check

schema = DataFrameSchema(

    columns={"column1": Column(int)},

    index=MultiIndex([

        Index(str,

              Check(lambda s: s.isin(["foo", "bar"])),

              name="index0"),

        Index(int, name="index1"),

    ])

)

df = pd.DataFrame(

    data={"column1": [1, 2, 3]},

    index=pd.MultiIndex.from\_arrays(

        [["foo", "bar", "foo"], [0, 1,2 ]],

        names=["index0", "index1"]

    )

)

print(schema.validate(df))

```

```

               column1

index0 index1

foo    0             1

bar    1             2

foo    2             3

```

#### Get Pandas Data Types[#](#get-pandas-data-types "Permalink to this headline")

Pandas provides a dtype parameter for casting a dataframe to a specific dtype

schema. [`DataFrameSchema`](index.html#pandera.schemas.DataFrameSchema "pandera.schemas.DataFrameSchema") provides

a `dtypes` property which returns a

dictionary whose keys are column names and values are [`DataType`](index.html#pandera.dtypes.DataType "pandera.dtypes.DataType").

Some examples of where this can be provided to pandas are:

* <https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.read_csv.html>

* <https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.astype.html>

```

import pandas as pd

import pandera as pa

schema = pa.DataFrameSchema(

    columns={

      "column1": pa.Column(int),

      "column2": pa.Column(pa.Category),

      "column3": pa.Column(bool)

    },

)

df = (

    pd.DataFrame.from\_dict(

        {

            "a": {"column1": 1, "column2": "valueA", "column3": True},

            "b": {"column1": 1, "column2": "valueB", "column3": True},

        },

        orient="index",

    )

    .astype({col: str(dtype) for col, dtype in schema.dtypes.items()})

    .sort\_index(axis=1)

)

print(schema.validate(df))

```

```

   column1 column2  column3

a        1  valueA     True

b        1  valueB     True

```

#### DataFrameSchema Transformations[#](#dataframeschema-transformations "Permalink to this headline")

Once you’ve defined a schema, you can then make modifications to it, both on

the schema level – such as adding or removing columns and setting or resetting

the index – or on the column level – such as changing the data type or checks.

This is useful for re-using schema objects in a data pipeline when additional

computation has been done on a dataframe, where the column objects may have

changed or perhaps where additional checks may be required.

```

import pandas as pd

import pandera as pa

data = pd.DataFrame({"col1": range(1, 6)})

schema = pa.DataFrameSchema(

    columns={"col1": pa.Column(int, pa.Check(lambda s: s >= 0))},

    strict=True)

transformed\_schema = schema.add\_columns({

    "col2": pa.Column(str, pa.Check(lambda s: s == "value")),

    "col3": pa.Column(float, pa.Check(lambda x: x == 0.0)),

})

# validate original data

data = schema.validate(data)

# transformation

transformed\_data = data.assign(col2="value", col3=0.0)

# validate transformed data

print(transformed\_schema.validate(transformed\_data))

```

```

   col1   col2  col3

0     1  value   0.0

1     2  value   0.0

2     3  value   0.0

3     4  value   0.0

4     5  value   0.0

```

Similarly, if you want dropped columns to be explicitly validated in a

data pipeline:

```

import pandera as pa

schema = pa.DataFrameSchema(

    columns={

        "col1": pa.Column(int, pa.Check(lambda s: s >= 0)),

        "col2": pa.Column(str, pa.Check(lambda x: x <= 0)),

        "col3": pa.Column(object, pa.Check(lambda x: x == 0)),

    },

    strict=True,

)

new\_schema = schema.remove\_columns(["col2", "col3"])

print(new\_schema)

```

```

<Schema DataFrameSchema(

    columns={

        'col1': <Schema Column(name=col1, type=DataType(int64))>

    },

    checks=[],

    coerce=False,

    dtype=None,

    index=None,

    strict=True

    name=None,

    ordered=False,

    unique_column_names=False

)>

```

If during the course of a data pipeline one of your columns is moved into the

index, you can simply update the initial input schema using the

[`set\_index()`](index.html#pandera.schemas.DataFrameSchema.set_index "pandera.schemas.DataFrameSchema.set_index") method to create a schema for

the pipeline output.

```

import pandera as pa

from pandera import Column, DataFrameSchema, Check, Index

schema = DataFrameSchema(

    {

        "column1": Column(int),

        "column2": Column(float)

    },

    index=Index(int, name = "column3"),

    strict=True,

    coerce=True,

)

print(schema.set\_index(["column1"], append = True))

```

```

<Schema DataFrameSchema(

    columns={

        'column2': <Schema Column(name=column2, type=DataType(float64))>

    },

    checks=[],

    coerce=True,

    dtype=None,

    index=<Schema MultiIndex(

        indexes=[

            <Schema Index(name=column3, type=DataType(int64))>

            <Schema Index(name=column1, type=DataType(int64))>

        ]

        coerce=False,

        strict=False,

        name=None,

        ordered=True

    )>,

    strict=True

    name=None,

    ordered=False,

    unique_column_names=False

)>

```

The available methods for altering the schema are:

[`add\_columns()`](index.html#pandera.schemas.DataFrameSchema.add_columns "pandera.schemas.DataFrameSchema.add_columns") ,

[`remove\_columns()`](index.html#pandera.schemas.DataFrameSchema.remove_columns "pandera.schemas.DataFrameSchema.remove_columns"),

[`update\_columns()`](index.html#pandera.schemas.DataFrameSchema.update_columns "pandera.schemas.DataFrameSchema.update_columns"),

[`rename\_columns()`](index.html#pandera.schemas.DataFrameSchema.rename_columns "pandera.schemas.DataFrameSchema.rename_columns"),

[`set\_index()`](index.html#pandera.schemas.DataFrameSchema.set_index "pandera.schemas.DataFrameSchema.set_index"),

and [`reset\_index()`](index.html#pandera.schemas.DataFrameSchema.reset_index "pandera.schemas.DataFrameSchema.reset_index").

### Schema Models[#](#schema-models "Permalink to this headline")

*new in 0.5.0*

`pandera` provides a class-based API that’s heavily inspired by

[pydantic](https://pydantic-docs.helpmanual.io/). In contrast to the

[object-based API](index.html#dataframeschemas), you can define schema models in

much the same way you’d define `pydantic` models.

Schema Models are annotated with the [`pandera.typing`](index.html#module-pandera.typing "pandera.typing") module using the standard

[typing](https://docs.python.org/3/library/typing.html) syntax. Models can be

explicitly converted to a [`DataFrameSchema`](index.html#pandera.schemas.DataFrameSchema "pandera.schemas.DataFrameSchema") or used to validate a

[`DataFrame`](https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DataFrame.html#pandas.DataFrame "(in pandas v1.5.1)") directly.

Note

Due to current limitations in the pandas library (see discussion

[here](https://github.com/pandera-dev/pandera/issues/253#issuecomment-665338337)),

`pandera` annotations are only used for **run-time** validation and **cannot** be

leveraged by static-type checkers like [mypy](http://mypy-lang.org/). See the

discussion [here](https://github.com/pandera-dev/pandera/issues/253#issuecomment-665338337)

for more details.

#### Basic Usage[#](#basic-usage "Permalink to this headline")

```

import pandas as pd

import pandera as pa

from pandera.typing import Index, DataFrame, Series

class InputSchema(pa.SchemaModel):

    year: Series[int] = pa.Field(gt=2000, coerce=True)

    month: Series[int] = pa.Field(ge=1, le=12, coerce=True)

    day: Series[int] = pa.Field(ge=0, le=365, coerce=True)

class OutputSchema(InputSchema):

    revenue: Series[float]

@pa.check\_types

def transform(df: DataFrame[InputSchema]) -> DataFrame[OutputSchema]:

    return df.assign(revenue=100.0)

df = pd.DataFrame({

    "year": ["2001", "2002", "2003"],

    "month": ["3", "6", "12"],

    "day": ["200", "156", "365"],

})

transform(df)

invalid\_df = pd.DataFrame({

    "year": ["2001", "2002", "1999"],

    "month": ["3", "6", "12"],

    "day": ["200", "156", "365"],

})

transform(invalid\_df)

```

```

Traceback (most recent call last):

...

pandera.errors.SchemaError: <Schema Column: 'year' type=DataType(int64)> failed element-wise validator 0:

<Check greater_than: greater_than(2000)>

failure cases:

   index  failure_case

0      2          1999

```

As you can see in the example above, you can define a schema by sub-classing

[`SchemaModel`](index.html#pandera.model.SchemaModel "pandera.model.SchemaModel") and defining column/index fields as class attributes.

The [`check\_types()`](index.html#pandera.decorators.check_types "pandera.decorators.check_types") decorator is required to perform validation of the dataframe at

run-time.

Note that [`Field`](index.html#pandera.model_components.Field "pandera.model_components.Field") s apply to both

[`Column`](index.html#pandera.schema_components.Column "pandera.schema_components.Column") and [`Index`](index.html#pandera.schema_components.Index "pandera.schema_components.Index")

objects, exposing the built-in `Check` s via key-word arguments.

*(New in 0.6.2)* When you access a class attribute defined on the schema,

it will return the name of the column used in the validated pd.DataFrame.

In the example above, this will simply be the string “year”.

```

print(f"Column name for 'year' is {InputSchema.year}\n")

print(df.loc[:, [InputSchema.year, "day"]])

```

```

Column name for 'year' is year

   year  day

0  2001  200

1  2002  156

2  2003  365

```

#### Validate on Initialization[#](#validate-on-initialization "Permalink to this headline")

*new in 0.8.0*

Pandera provides an interface for validating dataframes on initialization.

This API uses the `pandera.typing.pandas.DataFrame` generic type

to validated against the [`SchemaModel`](index.html#pandera.model.SchemaModel "pandera.model.SchemaModel") type variable

on initialization:

```

import pandas as pd

import pandera as pa

from pandera.typing import DataFrame, Series

class Schema(pa.SchemaModel):

    state: Series[str]

    city: Series[str]

    price: Series[int] = pa.Field(in\_range={"min\_value": 5, "max\_value": 20})

df = DataFrame[Schema](

    {

        'state': ['NY','FL','GA','CA'],

        'city': ['New York', 'Miami', 'Atlanta', 'San Francisco'],

        'price': [8, 12, 10, 16],

    }

)

print(df)

```

```

  state           city  price

0    NY       New York      8

1    FL          Miami     12

2    GA        Atlanta     10

3    CA  San Francisco     16

```

Refer to [Supported DataFrame Libraries](index.html#supported-dataframe-libraries) to see how this syntax applies

to other supported dataframe types.

#### Converting to DataFrameSchema[#](#converting-to-dataframeschema "Permalink to this headline")

You can easily convert a [`SchemaModel`](index.html#pandera.model.SchemaModel "pandera.model.SchemaModel") class into a

[`DataFrameSchema`](index.html#pandera.schemas.DataFrameSchema "pandera.schemas.DataFrameSchema"):

```

print(InputSchema.to\_schema())

```

```

<Schema DataFrameSchema(

    columns={

        'year': <Schema Column(name=year, type=DataType(int64))>

        'month': <Schema Column(name=month, type=DataType(int64))>

        'day': <Schema Column(name=day, type=DataType(int64))>

    },

    checks=[],

    coerce=False,

    dtype=None,

    index=None,

    strict=False

    name=InputSchema,

    ordered=False,

    unique_column_names=False

)>

```

You can also use the [`validate()`](index.html#pandera.model.SchemaModel.validate "pandera.model.SchemaModel.validate") method to

validate dataframes:

```

print(InputSchema.validate(df))

```

```

   year  month  day

0  2001      3  200

1  2002      6  156

2  2003     12  365

```

Or you can use the [`SchemaModel()`](index.html#pandera.model.SchemaModel "pandera.model.SchemaModel") class directly to

validate dataframes, which is syntactic sugar that simply delegates to the

[`validate()`](index.html#pandera.model.SchemaModel.validate "pandera.model.SchemaModel.validate") method.

```

print(InputSchema(df))

```

```

   year  month  day

0  2001      3  200

1  2002      6  156

2  2003     12  365

```

#### Excluded attributes[#](#excluded-attributes "Permalink to this headline")

Class variables which begin with an underscore will be automatically excluded from

the model. [Config](#schema-model-config) is also a reserved name.

However, [aliases](#schema-model-alias) can be used to circumvent these limitations.

#### Supported dtypes[#](#supported-dtypes "Permalink to this headline")

Any dtypes supported by `pandera` can be used as type parameters for

`Series` and `Index`. There are,

however, a couple of gotchas.

##### Dtype aliases[#](#dtype-aliases "Permalink to this headline")

```

import pandera as pa

from pandera.typing import Series, String

class Schema(pa.SchemaModel):

    a: Series[String]

```

##### Type Vs instance[#](#type-vs-instance "Permalink to this headline")

You must give a **type**, not an **instance**.

✔ Good:

```

import pandas as pd

class Schema(pa.SchemaModel):

    a: Series[pd.StringDtype]

```

✘ Bad:

```

class Schema(pa.SchemaModel):

    a: Series[pd.StringDtype()]

```

```

Traceback (most recent call last):

...

TypeError: Parameters to generic types must be types. Got string[python].

```

##### Parametrized dtypes[#](#parametrized-dtypes "Permalink to this headline")

Pandas supports a couple of parametrized dtypes. As of pandas 1.2.0:

| Kind of Data | Data Type | Parameters |

| --- | --- | --- |

| tz-aware datetime | `DatetimeTZDtype` | `unit`, `tz` |

| Categorical | `CategoricalDtype` | `categories`, `ordered` |

| period | `PeriodDtype` | `freq` |

| sparse | `SparseDtype` | `dtype`, `fill\_value` |

| intervals | `IntervalDtype` | `subtype` |

###### Annotated[#](#annotated "Permalink to this headline")

Parameters can be given via [`typing.Annotated`](https://docs.python.org/3/library/typing.html#typing.Annotated "(in Python v3.11)"). It requires python >= 3.9 or

[typing\_extensions](https://pypi.org/project/typing-extensions/), which is already a

requirement of Pandera. Unfortunately [`typing.Annotated`](https://docs.python.org/3/library/typing.html#typing.Annotated "(in Python v3.11)") has not been backported

to python 3.6.

✔ Good:

```

try:

    from typing import Annotated  # python 3.9+

except ImportError:

    from typing\_extensions import Annotated

class Schema(pa.SchemaModel):

    col: Series[Annotated[pd.DatetimeTZDtype, "ns", "est"]]

```

Furthermore, you must pass all parameters in the order defined in the dtype’s

constructor (see [table](#parameterized-dtypes)).

✘ Bad:

```

class Schema(pa.SchemaModel):

    col: Series[Annotated[pd.DatetimeTZDtype, "utc"]]

Schema.to\_schema()

```

```

Traceback (most recent call last):

...

TypeError: Annotation 'DatetimeTZDtype' requires all positional arguments ['unit', 'tz'].

```

###### Field[#](#field "Permalink to this headline")

✔ Good:

```

class SchemaFieldDatetimeTZDtype(pa.SchemaModel):

    col: Series[pd.DatetimeTZDtype] = pa.Field(dtype\_kwargs={"unit": "ns", "tz": "EST"})

```

You cannot use both [`typing.Annotated`](https://docs.python.org/3/library/typing.html#typing.Annotated "(in Python v3.11)") and `dtype\_kwargs`.

✘ Bad:

```

class SchemaFieldDatetimeTZDtype(pa.SchemaModel):

    col: Series[Annotated[pd.DatetimeTZDtype, "ns", "est"]] = pa.Field(dtype\_kwargs={"unit": "ns", "tz": "EST"})

Schema.to\_schema()

```

```

Traceback (most recent call last):

...

TypeError: Cannot specify redundant 'dtype_kwargs' for pandera.typing.Series[typing_extensions.Annotated[pandas.core.dtypes.dtypes.DatetimeTZDtype, 'ns', 'est']].

Usage Tip: Drop 'typing.Annotated'.

```

#### Required Columns[#](#required-columns "Permalink to this headline")

By default all columns specified in the schema are [required](index.html#required), meaning

that if a column is missing in the input DataFrame an exception will be

thrown. If you want to make a column optional, annotate it with [`typing.Optional`](https://docs.python.org/3/library/typing.html#typing.Optional "(in Python v3.11)").

```

from typing import Optional

import pandas as pd

import pandera as pa

from pandera.typing import Series

class Schema(pa.SchemaModel):

    a: Series[str]

    b: Optional[Series[int]]

df = pd.DataFrame({"a": ["2001", "2002", "2003"]})

Schema.validate(df)

```

#### Schema Inheritance[#](#schema-inheritance "Permalink to this headline")

You can also use inheritance to build schemas on top of a base schema.

```

class BaseSchema(pa.SchemaModel):

    year: Series[str]

class FinalSchema(BaseSchema):

    year: Series[int] = pa.Field(ge=2000, coerce=True)  # overwrite the base type

    passengers: Series[int]

    idx: Index[int] = pa.Field(ge=0)

df = pd.DataFrame({

    "year": ["2000", "2001", "2002"],

})

@pa.check\_types

def transform(df: DataFrame[BaseSchema]) -> DataFrame[FinalSchema]:

    return (

        df.assign(passengers=[61000, 50000, 45000])

        .set\_index(pd.Index([1, 2, 3]))

        .astype({"year": int})

    )

print(transform(df))

```

```

   year  passengers

1  2000       61000

2  2001       50000

3  2002       45000

```

#### Config[#](#config "Permalink to this headline")

Schema-wide options can be controlled via the `Config` class on the `SchemaModel`

subclass. The full set of options can be found in the [`BaseConfig`](index.html#pandera.model.BaseConfig "pandera.model.BaseConfig")

class.

```

class Schema(pa.SchemaModel):

    year: Series[int] = pa.Field(gt=2000, coerce=True)

    month: Series[int] = pa.Field(ge=1, le=12, coerce=True)

    day: Series[int] = pa.Field(ge=0, le=365, coerce=True)

    class Config:

        name = "BaseSchema"

        strict = True

        coerce = True

        foo = "bar"  # Interpreted as dataframe check

```

It is not required for the `Config` to subclass [`BaseConfig`](index.html#pandera.model.BaseConfig "pandera.model.BaseConfig") but

it **must** be named ‘**Config**’.

See [Registered Custom Checks with the Class-based API](index.html#class-based-api-dataframe-checks) for details on using registered dataframe checks.

#### MultiIndex[#](#multiindex "Permalink to this headline")

The [`MultiIndex`](index.html#pandera.schema_components.MultiIndex "pandera.schema_components.MultiIndex") capabilities are also supported with

the class-based API:

```

import pandera as pa

from pandera.typing import Index, Series

class MultiIndexSchema(pa.SchemaModel):

    year: Index[int] = pa.Field(gt=2000, coerce=True)

    month: Index[int] = pa.Field(ge=1, le=12, coerce=True)

    passengers: Series[int]

    class Config:

        # provide multi index options in the config

        multiindex\_name = "time"

        multiindex\_strict = True

        multiindex\_coerce = True

index = MultiIndexSchema.to\_schema().index

print(index)

```

```

<Schema MultiIndex(

    indexes=[

        <Schema Index(name=year, type=DataType(int64))>

        <Schema Index(name=month, type=DataType(int64))>

    ]

    coerce=True,

    strict=True,

    name=time,

    ordered=True

)>

```

```

from pprint import pprint

pprint({name: col.checks for name, col in index.columns.items()})

```

```

{'month': [<Check greater_than_or_equal_to: greater_than_or_equal_to(1)>,

        <Check less_than_or_equal_to: less_than_or_equal_to(12)>],

'year': [<Check greater_than: greater_than(2000)>]}

```

Multiple `Index` annotations are automatically converted into a

[`MultiIndex`](index.html#pandera.schema_components.MultiIndex "pandera.schema_components.MultiIndex"). MultiIndex options are given in the

[Config](#schema-model-config).

#### Index Name[#](#index-name "Permalink to this headline")

Use `check\_name` to validate the index name of a single-index dataframe:

```

import pandas as pd

import pandera as pa

from pandera.typing import Index, Series

class Schema(pa.SchemaModel):

    year: Series[int] = pa.Field(gt=2000, coerce=True)

    passengers: Series[int]

    idx: Index[int] = pa.Field(ge=0, check\_name=True)

df = pd.DataFrame({

    "year": [2001, 2002, 2003],

    "passengers": [61000, 50000, 45000],

})

Schema.validate(df)

```

```

Traceback (most recent call last):

...

pandera.errors.SchemaError: Expected <class 'pandera.schema_components.Index'> to have name 'idx', found 'None'

```

`check\_name` default value of `None` translates to `True` for columns and multi-index.

#### Custom Checks[#](#custom-checks "Permalink to this headline")

Unlike the object-based API, custom checks can be specified as class methods.

##### Column/Index checks[#](#column-index-checks "Permalink to this headline")

```

import pandera as pa

from pandera.typing import Index, Series

class CustomCheckSchema(pa.SchemaModel):

    a: Series[int] = pa.Field(gt=0, coerce=True)

    abc: Series[int]

    idx: Index[str]

    @pa.check("a", name="foobar")

    def custom\_check(cls, a: Series[int]) -> Series[bool]:

        return a < 100

    @pa.check("^a", regex=True, name="foobar")

    def custom\_check\_regex(cls, a: Series[int]) -> Series[bool]:

        return a > 0

    @pa.check("idx")

    def check\_idx(cls, idx: Index[int]) -> Series[bool]:

        return idx.str.contains("dog")

```

Note

* You can supply the key-word arguments of the [`Check`](index.html#pandera.checks.Check "pandera.checks.Check") class

initializer to get the flexibility of [groupby checks](index.html#column-check-groups)

* Similarly to `pydantic`, [`classmethod()`](https://docs.python.org/3/library/functions.html#classmethod "(in Python v3.11)") decorator is added behind the scenes

if omitted.

* You still may need to add the `@classmethod` decorator *after* the

[`check()`](index.html#pandera.model_components.check "pandera.model_components.check") decorator if your static-type checker or

linter complains.

* Since `checks` are class methods, the first argument value they receive is a

SchemaModel subclass, not an instance of a model.

```

from typing import Dict

class GroupbyCheckSchema(pa.SchemaModel):

    value: Series[int] = pa.Field(gt=0, coerce=True)

    group: Series[str] = pa.Field(isin=["A", "B"])

    @pa.check("value", groupby="group", regex=True, name="check\_means")

    def check\_groupby(cls, grouped\_value: Dict[str, Series[int]]) -> bool:

        return grouped\_value["A"].mean() < grouped\_value["B"].mean()

df = pd.DataFrame({

    "value": [100, 110, 120, 10, 11, 12],

    "group": list("AAABBB"),

})

print(GroupbyCheckSchema.validate(df))

```

```

Traceback (most recent call last):

...

pandera.errors.SchemaError: <Schema Column: 'value' type=DataType(int64)> failed series validator 1:

<Check check_means>

```

##### DataFrame Checks[#](#dataframe-checks "Permalink to this headline")

You can also define dataframe-level checks, similar to the

[object-based API](index.html#wide-checks), using the

`dataframe\_check()` decorator:

```

import pandas as pd

import pandera as pa

from pandera.typing import Index, Series

class DataFrameCheckSchema(pa.SchemaModel):

    col1: Series[int] = pa.Field(gt=0, coerce=True)

    col2: Series[float] = pa.Field(gt=0, coerce=True)

    col3: Series[float] = pa.Field(lt=0, coerce=True)

    @pa.dataframe\_check

    def product\_is\_negative(cls, df: pd.DataFrame) -> Series[bool]:

        return df["col1"] \* df["col2"] \* df["col3"] < 0

df = pd.DataFrame({

    "col1": [1, 2, 3],

    "col2": [5, 6, 7],

    "col3": [-1, -2, -3],

})

DataFrameCheckSchema.validate(df)

```

##### Inheritance[#](#inheritance "Permalink to this headline")

The custom checks are inherited and therefore can be overwritten by the subclass.

```

import pandas as pd

import pandera as pa

from pandera.typing import Index, Series

class Parent(pa.SchemaModel):

    a: Series[int] = pa.Field(coerce=True)

    @pa.check("a", name="foobar")

    def check\_a(cls, a: Series[int]) -> Series[bool]:

        return a < 100

class Child(Parent):

    a: Series[int] = pa.Field(coerce=False)

    @pa.check("a", name="foobar")

    def check\_a(cls, a: Series[int]) -> Series[bool]:

        return a > 100

is\_a\_coerce = Child.to\_schema().columns["a"].coerce

print(f"coerce: {is\_a\_coerce}")

```

```

coerce: False

```

```

df = pd.DataFrame({"a": [1, 2, 3]})

print(Child.validate(df))

```

```

Traceback (most recent call last):

...

pandera.errors.SchemaError: <Schema Column: 'a' type=DataType(int64)> failed element-wise validator 0:

<Check foobar>

failure cases:

    index  failure_case

0      0             1

1      1             2

2      2             3

```

#### Aliases[#](#aliases "Permalink to this headline")

[`SchemaModel`](index.html#pandera.model.SchemaModel "pandera.model.SchemaModel") supports columns which are not valid python variable names via the argument

alias of [`Field`](index.html#pandera.model_components.Field "pandera.model_components.Field").

Checks must reference the aliased names.

```

import pandera as pa

import pandas as pd

class Schema(pa.SchemaModel):

    col\_2020: pa.typing.Series[int] = pa.Field(alias=2020)

    idx: pa.typing.Index[int] = pa.Field(alias="\_idx", check\_name=True)

    @pa.check(2020)

    def int\_column\_lt\_100(cls, series):

        return series < 100

df = pd.DataFrame({2020: [99]}, index=[0])

df.index.name = "\_idx"

print(Schema.validate(df))

```

```

      2020

_idx

0       99

```

*(New in 0.6.2)* The alias is respected when using the class attribute to get the underlying

pd.DataFrame column name or index level name.

```

print(Schema.col\_2020)

```

```

2020

```

Very similar to the example above, you can also use the variable name directly within

the class scope, and it will respect the alias.

Note

To access a variable from the class scope, you need to make it a class attribute,

and therefore assign it a default [`Field`](index.html#pandera.model_components.Field "pandera.model_components.Field").

```

import pandera as pa

import pandas as pd

class Schema(pa.SchemaModel):

    a: pa.typing.Series[int] = pa.Field()

    col\_2020: pa.typing.Series[int] = pa.Field(alias=2020)

    @pa.check(col\_2020)

    def int\_column\_lt\_100(cls, series):

        return series < 100

    @pa.check(a)

    def int\_column\_gt\_100(cls, series):

        return series > 100

df = pd.DataFrame({2020: [99], "a": [101]})

print(Schema.validate(df))

```

```

      2020    a

0       99  101

```

### Series Schemas[#](#series-schemas "Permalink to this headline")

The [`SeriesSchema`](index.html#pandera.schemas.SeriesSchema "pandera.schemas.SeriesSchema") class allows for the validation of pandas

`Series` objects, and are very similar to [columns](index.html#column) and

[indexes](index.html#index) described in [DataFrameSchemas](index.html#dataframeschemas).

```

import pandas as pd

import pandera as pa

# specify multiple validators

schema = pa.SeriesSchema(

    str,

    checks=[

        pa.Check(lambda s: s.str.startswith("foo")),

        pa.Check(lambda s: s.str.endswith("bar")),

        pa.Check(lambda x: len(x) > 3, element\_wise=True)

    ],

    nullable=False,

    unique=False,

    name="my\_series")

validated\_series = schema.validate(

    pd.Series(["foobar", "foobar", "foobar"], name="my\_series"))

print(validated\_series)

```

```

0    foobar

1    foobar

2    foobar

Name: my_series, dtype: object

```

### Checks[#](#checks "Permalink to this headline")

#### Checking column properties[#](#checking-column-properties "Permalink to this headline")

[`Check`](index.html#pandera.checks.Check "pandera.checks.Check") objects accept a function as a required argument, which is

expected to take a `pa.Series` input and output a `boolean` or a `Series`

of boolean values. For the check to pass, all of the elements in the boolean

series must evaluate to `True`, for example:

```

import pandera as pa

check\_lt\_10 = pa.Check(lambda s: s <= 10)

schema = pa.DataFrameSchema({"column1": pa.Column(int, check\_lt\_10)})

schema.validate(pd.DataFrame({"column1": range(10)}))

```

Multiple checks can be applied to a column:

```

schema = pa.DataFrameSchema({

    "column2": pa.Column(str, [

        pa.Check(lambda s: s.str.startswith("value")),

        pa.Check(lambda s: s.str.split("\_", expand=True).shape[1] == 2)

    ]),

})

```

#### Built-in Checks[#](#built-in-checks "Permalink to this headline")

For common validation tasks, built-in checks are available in `pandera`.

```

import pandera as pa

from pandera import Column, Check, DataFrameSchema

schema = DataFrameSchema({

    "small\_values": Column(float, Check.less\_than(100)),

    "one\_to\_three": Column(int, Check.isin([1, 2, 3])),

    "phone\_number": Column(str, Check.str\_matches(r'^[a-z0-9-]+$')),

})

```

See the [`Check`](index.html#pandera.checks.Check "pandera.checks.Check") API reference for a complete list of built-in checks.

#### Vectorized vs. Element-wise Checks[#](#vectorized-vs-element-wise-checks "Permalink to this headline")

By default, [`Check`](index.html#pandera.checks.Check "pandera.checks.Check") objects operate on `pd.Series`

objects. If you want to make atomic checks for each element in the Column, then

you can provide the `element\_wise=True` keyword argument:

```

import pandas as pd

import pandera as pa

schema = pa.DataFrameSchema({

    "a": pa.Column(

        int,

        checks=[

            # a vectorized check that returns a bool

            pa.Check(lambda s: s.mean() > 5, element\_wise=False),

            # a vectorized check that returns a boolean series

            pa.Check(lambda s: s > 0, element\_wise=False),

            # an element-wise check that returns a bool

            pa.Check(lambda x: x > 0, element\_wise=True),

        ]

    ),

})

df = pd.DataFrame({"a": [4, 4, 5, 6, 6, 7, 8, 9]})

schema.validate(df)

```

`element\_wise == False` by default so that you can take advantage of the

speed gains provided by the `pd.Series` API by writing vectorized

checks.

#### Handling Null Values[#](#handling-null-values "Permalink to this headline")

By default, `pandera` drops null values before passing the objects to

validate into the check function. For `Series` objects null elements are

dropped (this also applies to columns), and for `DataFrame` objects, rows

with any null value are dropped.

If you want to check the properties of a pandas data structure while preserving

null values, specify `Check(..., ignore\_na=False)` when defining a check.

Note that this is different from the `nullable` argument in [`Column`](index.html#pandera.schema_components.Column "pandera.schema_components.Column")

objects, which simply checks for null values in a column.

#### Column Check Groups[#](#column-check-groups "Permalink to this headline")

[`Column`](index.html#pandera.schema_components.Column "pandera.schema_components.Column") checks support grouping by a different column so that you

can make assertions about subsets of the column of interest. This

changes the function signature of the [`Check`](index.html#pandera.checks.Check "pandera.checks.Check") function so that its

input is a dict where keys are the group names and values are subsets of the

series being validated.

Specifying `groupby` as a column name, list of column names, or

callable changes the expected signature of the [`Check`](index.html#pandera.checks.Check "pandera.checks.Check")

function argument to:

`Callable[Dict[Any, pd.Series] -> Union[bool, pd.Series]`

where the dict keys are the discrete keys in the `groupby` columns.

In the example below we define a [`DataFrameSchema`](index.html#pandera.schemas.DataFrameSchema "pandera.schemas.DataFrameSchema") with column checks

for `height\_in\_feet` using a single column, multiple columns, and a more

complex groupby function that creates a new column `age\_less\_than\_15` on the

fly.

```

import pandas as pd

import pandera as pa

schema = pa.DataFrameSchema({

    "height\_in\_feet": pa.Column(

        float, [

            # groupby as a single column

            pa.Check(

                lambda g: g[False].mean() > 6,

                groupby="age\_less\_than\_20"),

            # define multiple groupby columns

            pa.Check(

                lambda g: g[(True, "F")].sum() == 9.1,

                groupby=["age\_less\_than\_20", "sex"]),

            # groupby as a callable with signature:

            # (DataFrame) -> DataFrameGroupBy

            pa.Check(

                lambda g: g[(False, "M")].median() == 6.75,

                groupby=lambda df: (

                    df.assign(age\_less\_than\_15=lambda d: d["age"] < 15)

                    .groupby(["age\_less\_than\_15", "sex"]))),

        ]),

    "age": pa.Column(int, pa.Check(lambda s: s > 0)),

    "age\_less\_than\_20": pa.Column(bool),

    "sex": pa.Column(str, pa.Check(lambda s: s.isin(["M", "F"])))

})

df = (

    pd.DataFrame({

        "height\_in\_feet": [6.5, 7, 6.1, 5.1, 4],

        "age": [25, 30, 21, 18, 13],

        "sex": ["M", "M", "F", "F", "F"]

    })

    .assign(age\_less\_than\_20=lambda x: x["age"] < 20)

)

schema.validate(df)

```

#### Wide Checks[#](#wide-checks "Permalink to this headline")

`pandera` is primarily designed to operate on long-form data (commonly known

as [tidy data](https://vita.had.co.nz/papers/tidy-data.pdf)), where each row

is an observation and each column is an attribute associated with an

observation.

However, `pandera` also supports checks on wide-form data to operate across

columns in a `DataFrame`. For example, if you want to make assertions about

`height` across two groups, the tidy dataset and schema might look like this:

```

import pandas as pd

import pandera as pa

df = pd.DataFrame({

    "height": [5.6, 6.4, 4.0, 7.1],

    "group": ["A", "B", "A", "B"],

})

schema = pa.DataFrameSchema({

    "height": pa.Column(

        float,

        pa.Check(lambda g: g["A"].mean() < g["B"].mean(), groupby="group")

    ),

    "group": pa.Column(str)

})

schema.validate(df)

```

Whereas the equivalent wide-form schema would look like this:

```

df = pd.DataFrame({

    "height\_A": [5.6, 4.0],

    "height\_B": [6.4, 7.1],

})

schema = pa.DataFrameSchema(

    columns={

        "height\_A": pa.Column(float),

        "height\_B": pa.Column(float),

    },

    # define checks at the DataFrameSchema-level

    checks=pa.Check(

        lambda df: df["height\_A"].mean() < df["height\_B"].mean()

    )

)

schema.validate(df)

```

You can see that when checks are supplied to the `DataFrameSchema` `checks`

key-word argument, the check function should expect a pandas `DataFrame` and

should return a `bool`, a `Series` of booleans, or a `DataFrame` of

boolean values.

#### Raise UserWarning on Check Failure[#](#raise-userwarning-on-check-failure "Permalink to this headline")

In some cases, you might want to raise a `UserWarning` and continue execution

of your program. The `Check` and `Hypothesis` classes and their built-in

methods support the keyword argument `raise\_warning`, which is `False`

by default. If set to `True`, the check will raise a `UserWarning` instead

of raising a `SchemaError` exception.

Note

Use this feature carefully! If the check is for informational purposes and

not critical for data integrity then use `raise\_warning=True`. However,

if the assumptions expressed in a `Check` are necessary conditions to

considering your data valid, do not set this option to true.

One scenario where you’d want to do this would be in a data pipeline that

does some preprocessing, checks for normality in certain columns, and writes

the resulting dataset to a table. In this case, you want to see if your

normality assumptions are not fulfilled by certain columns, but you still

want the resulting table for further analysis.

```

import warnings

import numpy as np

import pandas as pd

import pandera as pa

from scipy.stats import normaltest

np.random.seed(1000)

df = pd.DataFrame({

    "var1": np.random.normal(loc=0, scale=1, size=1000),

    "var2": np.random.uniform(low=0, high=10, size=1000),

})

normal\_check = pa.Hypothesis(

    test=normaltest,

    samples="normal\_variable",

    # null hypotheses: sample comes from a normal distribution. The

    # relationship function checks if we cannot reject the null hypothesis,

    # i.e. the p-value is greater or equal to alpha.

    relationship=lambda stat, pvalue, alpha=0.05: pvalue >= alpha,

    error="normality test",

    raise\_warning=True,

)

schema = pa.DataFrameSchema(

    columns={

        "var1": pa.Column(checks=normal\_check),

        "var2": pa.Column(checks=normal\_check),

    }

)

# catch and print warnings

with warnings.catch\_warnings(record=True) as caught\_warnings:

    warnings.simplefilter("always")

    validated\_df = schema(df)

    for warning in caught\_warnings:

        print(warning.message)

```

```

<Schema Column(name=var2, type=None)> failed series or dataframe validator 0:

<Check _hypothesis_check: normality test>

```

#### Registering Custom Checks[#](#registering-custom-checks "Permalink to this headline")

`pandera` now offers an interface to register custom checks functions so

that they’re available in the [`Check`](index.html#pandera.checks.Check "pandera.checks.Check") namespace. See

[the extensions](index.html#extensions) document for more information.

### Hypothesis Testing[#](#hypothesis-testing "Permalink to this headline")

`pandera` enables you to perform statistical hypothesis tests on your data.

Note

The hypothesis feature requires a pandera installation with `hypotheses`

dependency set. See the [installation](index.html#installation) instructions for

more details.

#### Overview[#](#overview "Permalink to this headline")

The [`Hypothesis`](index.html#pandera.hypotheses.Hypothesis "pandera.hypotheses.Hypothesis") class defines built in methods,

which can be called as in this example of a two-sample t-test:

```

import pandas as pd

import pandera as pa

from pandera import Column, DataFrameSchema, Check, Hypothesis

from scipy import stats

df = (

    pd.DataFrame({

        "height\_in\_feet": [6.5, 7, 6.1, 5.1, 4],

        "sex": ["M", "M", "F", "F", "F"]

    })

)

schema = DataFrameSchema({

    "height\_in\_feet": Column(

        float, [

            Hypothesis.two\_sample\_ttest(

                sample1="M",

                sample2="F",

                groupby="sex",

                relationship="greater\_than",

                alpha=0.05,

                equal\_var=True),

    ]),

    "sex": Column(str)

})

schema.validate(df)

```

```

Traceback (most recent call last):

...

pandera.SchemaError: <Schema Column: 'height_in_feet' type=float64> failed series validator 0: hypothesis_check: failed two sample ttest between 'M' and 'F'

```

You can also define custom hypotheses by passing in functions to the

`test` and `relationship` arguments.

The `test` function takes as input one or multiple array-like objects

and should return a `stat`, which is the test statistic, and `pvalue` for

assessing statistical significance. It also takes key-word arguments supplied

by the `test\_kwargs` dict when initializing a `Hypothesis` object.

The `relationship` function should take all of the outputs of `test` as

positional arguments, in addition to key-word arguments supplied by the

`relationship\_kwargs` dict.

Here’s an implementation of the two-sample t-test that uses the

[scipy implementation](https://docs.scipy.org/doc/scipy/reference/generated/scipy.stats.ttest_ind.html):

```

def two\_sample\_ttest(array1, array2):

    # the "height\_in\_feet" series is first grouped by "sex" and then

    # passed into the custom `test` function as two separate arrays in the

    # order specified in the `samples` argument.

    return stats.ttest\_ind(array1, array2)

def null\_relationship(stat, pvalue, alpha=0.01):

    return pvalue / 2 >= alpha

schema = DataFrameSchema({

    "height\_in\_feet": Column(

        float, [

            Hypothesis(

                test=two\_sample\_ttest,

                samples=["M", "F"],

                groupby="sex",

                relationship=null\_relationship,

                relationship\_kwargs={"alpha": 0.05}

            )

    ]),

    "sex": Column(str, checks=Check.isin(["M", "F"]))

})

schema.validate(df)

```

#### Wide Hypotheses[#](#wide-hypotheses "Permalink to this headline")

`pandera` is primarily designed to operate on long-form data (commonly known

as [tidy data](https://vita.had.co.nz/papers/tidy-data.pdf)), where each row

is an observation and columns are attributes associated with the observation.

However, `pandera` also supports hypothesis testing on wide-form data to

operate across columns in a `DataFrame`.

For example, if you want to make assertions about `height` across two groups,

the tidy dataset and schema might look like this:

```

import pandas as pd

import pandera as pa

from pandera import Check, DataFrameSchema, Column, Hypothesis

df = pd.DataFrame({

    "height": [5.6, 7.5, 4.0, 7.9],

    "group": ["A", "B", "A", "B"],

})

schema = DataFrameSchema({

    "height": Column(

        float, Hypothesis.two\_sample\_ttest(

            "A", "B",

            groupby="group",

            relationship="less\_than",

            alpha=0.05

        )

    ),

    "group": Column(str, Check(lambda s: s.isin(["A", "B"])))

})

schema.validate(df)

```

The equivalent wide-form schema would look like this:

```

import pandas as pd

import pandera as pa

from pandera import DataFrameSchema, Column, Hypothesis

df = pd.DataFrame({

    "height\_A": [5.6, 4.0],

    "height\_B": [7.5, 7.9],

})

schema = DataFrameSchema(

    columns={

        "height\_A": Column(Float),

        "height\_B": Column(Float),

    },

    # define checks at the DataFrameSchema-level

    checks=Hypothesis.two\_sample\_ttest(

        "height\_A", "height\_B",

        relationship="less\_than",

        alpha=0.05

    )

)

schema.validate(df)

```

### Pandera Data Types[#](#pandera-data-types "Permalink to this headline")

*new in 0.7.0*

#### Motivations[#](#motivations "Permalink to this headline")

Pandera defines its own interface for data types in order to abstract the

specifics of dataframe-like data structures in the python ecosystem, such

as Apache Spark, Apache Arrow and xarray.

Note

In the following section `Pandera Data Type` refers to a

[`pandera.dtypes.DataType`](index.html#pandera.dtypes.DataType "pandera.dtypes.DataType") object whereas `native data type` refers

to data types used by third-party libraries that Pandera supports (e.g. pandas).

Most of the time, it is transparent to end users since pandera columns and

indexes accept native data types. However, it is possible to extend the pandera

interface by:

* modifying the **data type check** performed during schema validation.

* modifying the behavior of the **coerce** argument for `DataFrameSchema`.

* adding your **own custom data types**.

#### DataType basics[#](#datatype-basics "Permalink to this headline")

All pandera data types inherit from [`pandera.dtypes.DataType`](index.html#pandera.dtypes.DataType "pandera.dtypes.DataType") and must

be hashable.

A data type implements three key methods:

* [`pandera.dtypes.DataType.check()`](index.html#pandera.dtypes.DataType.check "pandera.dtypes.DataType.check") which validates that data types are equivalent.

* [`pandera.dtypes.DataType.coerce()`](index.html#pandera.dtypes.DataType.coerce "pandera.dtypes.DataType.coerce") which coerces a data container

(e.g. [`pandas.Series`](https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.Series.html#pandas.Series "(in pandas v1.5.1)")) to the data type.

* The dunder method `\_\_str\_\_()` which should output the native alias.

For example `str(pandera.Float64) == "float64"`

For pandera’s validation methods to be aware of a data type, it has to be

registered with the targeted engine via [`pandera.engines.engine.Engine.register\_dtype()`](index.html#pandera.engines.engine.Engine.register_dtype "pandera.engines.engine.Engine.register_dtype").

An engine is in charge of mapping a pandera [`DataType`](index.html#pandera.dtypes.DataType "pandera.dtypes.DataType")

with a native data type counterpart belonging to a third-party library. The mapping

can be queried with [`pandera.engines.engine.Engine.dtype()`](index.html#pandera.engines.engine.Engine.dtype "pandera.engines.engine.Engine.dtype").

As of pandera `0.7.0`, only the pandas [`Engine`](index.html#pandera.engines.pandas_engine.Engine "pandera.engines.pandas_engine.Engine")

is supported.

#### Example[#](#example "Permalink to this headline")

Let’s extend [`pandas.BooleanDtype`](https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.BooleanDtype.html#pandas.BooleanDtype "(in pandas v1.5.1)") coercion to handle the string

literals `"True"` and `"False"`.

```

import pandas as pd

import pandera as pa

from pandera import dtypes

from pandera.engines import pandas\_engine

@pandas\_engine.Engine.register\_dtype  # step 1

@dtypes.immutable  # step 2

class LiteralBool(pandas\_engine.BOOL):  # step 3

    def coerce(self, series: pd.Series) -> pd.Series:

        """Coerce a pandas.Series to boolean types."""

        if pd.api.types.is\_string\_dtype(series):

            series = series.replace({"True": 1, "False": 0})

        return series.astype("boolean")

data = pd.Series(["True", "False"], name="literal\_bools")

# step 4

print(

    pa.SeriesSchema(LiteralBool(), coerce=True, name="literal\_bools")

    .validate(data)

    .dtype

)

```

```

boolean

```

The example above performs the following steps:

1. Register the data type with the pandas engine.

2. [`pandera.dtypes.immutable()`](index.html#pandera.dtypes.immutable "pandera.dtypes.immutable") creates an immutable (and hashable)

`dataclass()`.

3. Inherit [`pandera.engines.pandas\_engine.BOOL`](index.html#pandera.engines.pandas_engine.BOOL "pandera.engines.pandas_engine.BOOL"), which is the pandera

representation of [`pandas.BooleanDtype`](https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.BooleanDtype.html#pandas.BooleanDtype "(in pandas v1.5.1)"). This is not mandatory but

it makes our life easier by having already implemented all the required

methods.

4. Check that our new data type can coerce the string literals.

So far we did not override the default behavior:

```

import pandera as pa

pa.SeriesSchema("boolean", coerce=True).validate(data)

```

```

Traceback (most recent call last):

...

pandera.errors.SchemaError: Error while coercing 'literal_bools' to type boolean: Need to pass bool-like values

```

To completely replace the default [`BOOL`](index.html#pandera.engines.pandas_engine.BOOL "pandera.engines.pandas_engine.BOOL"),

we need to supply all the equivalent representations to

[`register\_dtype()`](index.html#pandera.engines.engine.Engine.register_dtype "pandera.engines.engine.Engine.register_dtype"). Behind the scenes, when

`pa.SeriesSchema("boolean")` is called the corresponding pandera data type

is looked up using [`pandera.engines.engine.Engine.dtype()`](index.html#pandera.engines.engine.Engine.dtype "pandera.engines.engine.Engine.dtype").

```

print(f"before: {pandas\_engine.Engine.dtype('boolean').\_\_class\_\_}")

@pandas\_engine.Engine.register\_dtype(

    equivalents=["boolean", pd.BooleanDtype, pd.BooleanDtype()],

)

@dtypes.immutable

class LiteralBool(pandas\_engine.BOOL):

    def coerce(self, series: pd.Series) -> pd.Series:

        """Coerce a pandas.Series to boolean types."""

        if pd.api.types.is\_string\_dtype(series):

            series = series.replace({"True": 1, "False": 0})

        return series.astype("boolean")

print(f"after: {pandas\_engine.Engine.dtype('boolean').\_\_class\_\_}")

for dtype in ["boolean", pd.BooleanDtype, pd.BooleanDtype()]:

    pa.SeriesSchema(dtype, coerce=True).validate(data)

```

```

before: <class 'pandera.engines.pandas_engine.BOOL'>

after: <class 'LiteralBool'>

```

Note

For convenience, we specified both `pd.BooleanDtype` and

`pd.BooleanDtype()` as equivalents. That gives us more flexibility in

what pandera schemas can recognize (see last for-loop above).

#### Parametrized data types[#](#parametrized-data-types "Permalink to this headline")

Some data types can be parametrized. One common example is

[`pandas.CategoricalDtype`](https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.CategoricalDtype.html#pandas.CategoricalDtype "(in pandas v1.5.1)").

The `equivalents` argument of

[`register\_dtype()`](index.html#pandera.engines.engine.Engine.register_dtype "pandera.engines.engine.Engine.register_dtype") does not handle

this situation but will automatically register a [`classmethod()`](https://docs.python.org/3/library/functions.html#classmethod "(in Python v3.11)") with

signature `from\_parametrized\_dtype(cls, equivalent:...)` if the decorated

[`DataType`](index.html#pandera.dtypes.DataType "pandera.dtypes.DataType") defines it. The `equivalent` argument must

be type-annotated because it is leveraged to dispatch the input of

[`dtype`](index.html#pandera.engines.engine.Engine.dtype "pandera.engines.engine.Engine.dtype") to the appropriate

`from\_parametrized\_dtype` class method.

For example, here is a snippet from [`pandera.engines.pandas\_engine.Category`](index.html#pandera.engines.pandas_engine.Category "pandera.engines.pandas_engine.Category"):

```

import pandas as pd

from pandera import dtypes

@classmethod

def from\_parametrized\_dtype(

    cls, cat: Union[dtypes.Category, pd.CategoricalDtype]

):

    """Convert a categorical to

 a Pandera :class:`pandera.dtypes.pandas\_engine.Category`."""

    return cls(categories=cat.categories, ordered=cat.ordered)  # type: ignore

```

Note

The dispatch mechanism relies on [`functools.singledispatch()`](https://docs.python.org/3/library/functools.html#functools.singledispatch "(in Python v3.11)").

Unlike the built-in implementation, [`typing.Union`](https://docs.python.org/3/library/typing.html#typing.Union "(in Python v3.11)") is recognized.

#### Defining the `coerce\_value` method[#](#defining-the-coerce-value-method "Permalink to this headline")

For pandera datatypes to understand how to correctly report coercion errors,

it needs to know how to coerce an individual value into the specified type.

All `pandas` data types are supported: `numpy` -based datatypes use the

underlying numpy dtype to coerce an individual value. The `pandas` -native

datatypes like [`CategoricalDtype`](https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.CategoricalDtype.html#pandas.CategoricalDtype "(in pandas v1.5.1)") and [`BooleanDtype`](https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.BooleanDtype.html#pandas.BooleanDtype "(in pandas v1.5.1)")

are also supported.

As an example of a special-cased `coerce\_value` implementation, see the

source code for [`pandera.engines.pandas\_engine.Category.coerce\_value()`](index.html#pandera.engines.pandas_engine.Category.coerce_value "pandera.engines.pandas_engine.Category.coerce_value"):

```

def coerce\_value(self, value: Any) -> Any:

    """Coerce an value to a particular type."""

    if value not in self.categories:  # type: ignore

        raise TypeError(

            f"value {value} cannot be coerced to type {self.type}"

        )

    return value

```

#### Logical data types[#](#logical-data-types "Permalink to this headline")

Taking inspiration from the [visions project](https://dylan-profiler.github.io/visions/visions/background/data_type_view.html#decoupling-physical-and-logical-types),

pandera provides an interface for defining logical data types.

Physical types represent the actual, underlying representation of the data.

e.g.: `Int8`, `Float32`, `String`, etc., whereas logical types represent the

abstracted understanding of that data. e.g.: `IPs`, `URLs`, `paths`, etc.

Validating a logical data type consists of validating the supporting physical data type

(see [Motivations](#dtypes-intro)) and a check on actual values. For example, an IP address data

type would validate that:

1. The data container type is a `String`.

2. The actual values are well-formed addresses.

Non-native Pandas dtype can also be wrapped in a [`numpy.object\_`](https://numpy.org/doc/stable/reference/arrays.scalars.html#numpy.object_ "(in NumPy v1.23)") and verified

using the data, since the object dtype alone is not enough to verify the

correctness. An example would be the standard [`decimal.Decimal`](https://docs.python.org/3/library/decimal.html#decimal.Decimal "(in Python v3.11)") class that can be

validated via the pandera DataType [`Decimal`](index.html#pandera.dtypes.Decimal "pandera.dtypes.Decimal").

To implement a logical data type, you just need to implement the method

[`pandera.dtypes.DataType.check()`](index.html#pandera.dtypes.DataType.check "pandera.dtypes.DataType.check") and make use of the `data\_container` argument to

perform checks on the values of the data.

For example, you can create an `IPAddress` datatype that inherits from the numpy string

physical type, thereby storing the values as strings, and checks whether the values actually

match an IP address regular expression.

```

import re

from typing import Optional, Iterable, Union

@pandas\_engine.Engine.register\_dtype

@dtypes.immutable

class IPAddress(pandas\_engine.NpString):

    def check(

        self,

        pandera\_dtype: dtypes.DataType,

        data\_container: Optional[pd.Series] = None,

    ) -> Union[bool, Iterable[bool]]:

        # ensure that the data container's data type is a string,

        # using the parent class's check implementation

        correct\_type = super().check(pandera\_dtype)

        if not correct\_type:

            return correct\_type

        # ensure the filepaths actually exist locally

        exp = re.compile(r"(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})")

        return data\_container.map(lambda x: exp.match(x) is not None)

    def \_\_str\_\_(self) -> str:

        return str(self.\_\_class\_\_.\_\_name\_\_)

    def \_\_repr\_\_(self) -> str:

        return f"DataType({self})"

schema = pa.DataFrameSchema(columns={"ips": pa.Column(IPAddress)})

schema.validate(pd.DataFrame({"ips": ["0.0.0.0", "0.0.0.1", "0.0.0.a"]}))

```

```

Traceback (most recent call last):

...

pandera.errors.SchemaError: expected series 'ips' to have type IPAddress:

failure cases:

index failure_case

0      2      0.0.0.a

```

### Decorators for Pipeline Integration[#](#decorators-for-pipeline-integration "Permalink to this headline")

If you have an existing data pipeline that uses pandas data structures,

you can use the [`check\_input()`](index.html#pandera.decorators.check_input "pandera.decorators.check_input") and [`check\_output()`](index.html#pandera.decorators.check_output "pandera.decorators.check_output") decorators

to easily check function arguments or returned variables from existing

functions.

#### Check Input[#](#check-input "Permalink to this headline")

Validates input pandas DataFrame/Series before entering the wrapped

function.

```

import pandas as pd

import pandera as pa

from pandera import DataFrameSchema, Column, Check, check\_input

df = pd.DataFrame({

   "column1": [1, 4, 0, 10, 9],

   "column2": [-1.3, -1.4, -2.9, -10.1, -20.4],

})

in\_schema = DataFrameSchema({

   "column1": Column(int,

                     Check(lambda x: 0 <= x <= 10, element\_wise=True)),

   "column2": Column(float, Check(lambda x: x < -1.2)),

})

# by default, check\_input assumes that the first argument is

# dataframe/series.

@check\_input(in\_schema)

def preprocessor(dataframe):

    dataframe["column3"] = dataframe["column1"] + dataframe["column2"]

    return dataframe

preprocessed\_df = preprocessor(df)

print(preprocessed\_df)

```

```

   column1  column2  column3

0        1     -1.3     -0.3

1        4     -1.4      2.6

2        0     -2.9     -2.9

3       10    -10.1     -0.1

4        9    -20.4    -11.4

```

You can also provide the argument name as a string

```

@check\_input(in\_schema, "dataframe")

def preprocessor(dataframe):

    ...

```

Or an integer representing the index in the positional arguments.

```

@check\_input(in\_schema, 1)

def preprocessor(foo, dataframe):

    ...

```

#### Check Output[#](#check-output "Permalink to this headline")

The same as `check\_input`, but this decorator checks the output

DataFrame/Series of the decorated function.

```

import pandas as pd

import pandera as pa

from pandera import DataFrameSchema, Column, Check, check\_output

preprocessed\_df = pd.DataFrame({

   "column1": [1, 4, 0, 10, 9],

})

# assert that all elements in "column1" are zero

out\_schema = DataFrameSchema({

    "column1": Column(int, Check(lambda x: x == 0))

})

# by default assumes that the pandas DataFrame/Schema is the only output

@check\_output(out\_schema)

def zero\_column\_1(df):

    df["column1"] = 0

    return df

# you can also specify in the index of the argument if the output is list-like

@check\_output(out\_schema, 1)

def zero\_column\_1\_arg(df):

    df["column1"] = 0

    return "foobar", df

# or the key containing the data structure to verify if the output is dict-like

@check\_output(out\_schema, "out\_df")

def zero\_column\_1\_dict(df):

    df["column1"] = 0

    return {"out\_df": df, "out\_str": "foobar"}

# for more complex outputs, you can specify a function

@check\_output(out\_schema, lambda x: x[1]["out\_df"])

def zero\_column\_1\_custom(df):

    df["column1"] = 0

    return ("foobar", {"out\_df": df})

zero\_column\_1(preprocessed\_df)

zero\_column\_1\_arg(preprocessed\_df)

zero\_column\_1\_dict(preprocessed\_df)

zero\_column\_1\_custom(preprocessed\_df)

```

#### Check IO[#](#check-io "Permalink to this headline")

For convenience, you can also use the [`check\_io()`](index.html#pandera.decorators.check_io "pandera.decorators.check_io")

decorator where you can specify input and output schemas more concisely:

```

import pandas as pd

import pandera as pa

from pandera import DataFrameSchema, Column, Check, check\_input

df = pd.DataFrame({

   "column1": [1, 4, 0, 10, 9],

   "column2": [-1.3, -1.4, -2.9, -10.1, -20.4],

})

in\_schema = DataFrameSchema({

   "column1": Column(int),

   "column2": Column(float),

})

out\_schema = in\_schema.add\_columns({"column3": Column(float)})

@pa.check\_io(df1=in\_schema, df2=in\_schema, out=out\_schema)

def preprocessor(df1, df2):

    return (df1 + df2).assign(column3=lambda x: x.column1 + x.column2)

preprocessed\_df = preprocessor(df, df)

print(preprocessed\_df)

```

```

   column1  column2  column3

0        2     -2.6     -0.6

1        8     -2.8      5.2

2        0     -5.8     -5.8

3       20    -20.2     -0.2

4       18    -40.8    -22.8

```

#### Decorate Functions and Coroutines[#](#decorate-functions-and-coroutines "Permalink to this headline")

*All* pandera decorators work on synchronous as well as asynchronous code, on both bound and unbound

functions/coroutines. For example, one can use the same decorators on:

* sync/async functions

* sync/async methods

* sync/async class methods

* sync/async static methods

All decorators work on sync/async regular/class/static methods of metaclasses as well.

```

import pandera as pa

from pandera.typing import DataFrame, Series

class Schema(pa.SchemaModel):

    col1: Series[int]

    class Config:

        strict = True

@pa.check\_types

async def coroutine(df: DataFrame[Schema]) -> DataFrame[Schema]:

    return df

@pa.check\_types

async def function(df: DataFrame[Schema]) -> DataFrame[Schema]:

    return df

class SomeClass:

    @pa.check\_output(Schema.to\_schema())

    async def regular\_coroutine(self, df) -> DataFrame[Schema]:

        return df

    @classmethod

    @pa.check\_input(Schema.to\_schema(), "df")

    async def class\_coroutine(cls, df):

        return Schema.validate(df)

    @staticmethod

    @pa.check\_io(df=Schema.to\_schema(), out=Schema.to\_schema())

    def static\_method(df):

        return df

```

### Schema Inference[#](#schema-inference "Permalink to this headline")

*New in version 0.4.0*

With simple use cases, writing a schema definition manually is pretty

straight-forward with pandera. However, it can get tedious to do this with

dataframes that have many columns of various data types.

To help you handle these cases, the [`infer\_schema()`](index.html#pandera.schema_inference.infer_schema "pandera.schema_inference.infer_schema") function enables

you to quickly infer a draft schema from a pandas dataframe or series. Below

is a simple example:

```

import pandas as pd

import pandera as pa

from pandera import Check, Column, DataFrameSchema

df = pd.DataFrame({

    "column1": [5, 10, 20],

    "column2": ["a", "b", "c"],

    "column3": pd.to\_datetime(["2010", "2011", "2012"]),

})

schema = pa.infer\_schema(df)

print(schema)

```

```

 <Schema DataFrameSchema(

     columns={

         'column1': <Schema Column(name=column1, type=DataType(int64))>

         'column2': <Schema Column(name=column2, type=DataType(object))>

         'column3': <Schema Column(name=column3, type=DataType(datetime64[ns]))>

     },

     checks=[],

     coerce=True,

     dtype=None,

     index=<Schema Index(name=None, type=DataType(int64))>,

     strict=False

     name=None,

     ordered=False,

     unique_column_names=False

 )>

```

These inferred schemas are **rough drafts** that shouldn’t be used for

validation without modification. You can modify the inferred schema to

obtain the schema definition that you’re satisfied with.

For [`DataFrameSchema`](index.html#pandera.schemas.DataFrameSchema "pandera.schemas.DataFrameSchema") objects, the following methods create

modified copies of the schema:

* [`add\_columns()`](index.html#pandera.schemas.DataFrameSchema.add_columns "pandera.schemas.DataFrameSchema.add_columns")

* [`remove\_columns()`](index.html#pandera.schemas.DataFrameSchema.remove_columns "pandera.schemas.DataFrameSchema.remove_columns")

* [`update\_column()`](index.html#pandera.schemas.DataFrameSchema.update_column "pandera.schemas.DataFrameSchema.update_column")

For [`SeriesSchema`](index.html#pandera.schemas.SeriesSchema "pandera.schemas.SeriesSchema") objects:

* `set\_checks()`

The section below describes two workflows for persisting and modifying an

inferred schema.

#### Schema Persistence[#](#schema-persistence "Permalink to this headline")

The schema persistence feature requires a pandera installation with the `io`

extension. See the [installation](index.html#installation) instructions for more

details.

There are two ways of persisting schemas, inferred or otherwise.

##### Write to a Python script[#](#write-to-a-python-script "Permalink to this headline")

You can also write your schema to a python script with [`to\_script()`](index.html#pandera.io.to_script "pandera.io.to_script"):

```

# supply a file-like object, Path, or str to write to a file. If not

# specified, to\_script will output the code as a string.

schema\_script = schema.to\_script()

print(schema\_script)

```

```

 from pandas import Timestamp

 from pandera import DataFrameSchema, Column, Check, Index, MultiIndex

 schema = DataFrameSchema(

     columns={

         "column1": Column(

             dtype=pandera.engines.numpy_engine.Int64,

             checks=[

                 Check.greater_than_or_equal_to(min_value=5.0),

                 Check.less_than_or_equal_to(max_value=20.0),

             ],

             nullable=False,

             unique=False,

             coerce=False,

             required=True,

             regex=False,

             description=None,

             title=None,

         ),

         "column2": Column(

             dtype=pandera.engines.numpy_engine.Object,

             checks=None,

             nullable=False,

             unique=False,

             coerce=False,

             required=True,

             regex=False,

             description=None,

             title=None,

         ),

         "column3": Column(

             dtype=pandera.engines.pandas_engine.DateTime,

             checks=[

                 Check.greater_than_or_equal_to(

                     min_value=Timestamp("2010-01-01 00:00:00")

                 ),

                 Check.less_than_or_equal_to(

                     max_value=Timestamp("2012-01-01 00:00:00")

                 ),

             ],

             nullable=False,

             unique=False,

             coerce=False,

             required=True,

             regex=False,

             description=None,

             title=None,

         ),

     },

     index=Index(

         dtype=pandera.engines.numpy_engine.Int64,

         checks=[

             Check.greater_than_or_equal_to(min_value=0.0),

             Check.less_than_or_equal_to(max_value=2.0),

         ],

         nullable=False,

         coerce=False,

         name=None,

         description=None,

         title=None,

     ),

     coerce=True,

     strict=False,

     name=None,

 )

```

As a python script, you can iterate on an inferred schema and use it to

validate data once you are satisfied with your schema definition.

##### Write to YAML[#](#write-to-yaml "Permalink to this headline")

You can also write the schema object to a yaml file with [`to\_yaml()`](index.html#pandera.io.to_yaml "pandera.io.to_yaml"),

and you can then read it into memory with [`from\_yaml()`](index.html#pandera.io.from_yaml "pandera.io.from_yaml"). The

[`to\_yaml()`](index.html#pandera.schemas.DataFrameSchema.to_yaml "pandera.schemas.DataFrameSchema.to_yaml") and [`from\_yaml()`](index.html#pandera.schemas.DataFrameSchema.from_yaml "pandera.schemas.DataFrameSchema.from_yaml")

is a convenience method for this functionality.

```

# supply a file-like object, Path, or str to write to a file. If not

# specified, to\_yaml will output a yaml string.

yaml\_schema = schema.to\_yaml()

print(yaml\_schema.replace(f"{pa.\_\_version\_\_}", "{PANDERA\_VERSION}"))

```

```

 schema_type: dataframe

 version: {PANDERA_VERSION}

 columns:

   column1:

     title: null

     description: null

     dtype: int64

     nullable: false

     checks:

       greater_than_or_equal_to: 5.0

       less_than_or_equal_to: 20.0

     unique: false

     coerce: false

     required: true

     regex: false

   column2:

     title: null

     description: null

     dtype: object

     nullable: false

     checks: null

     unique: false

     coerce: false

     required: true

     regex: false

   column3:

     title: null

     description: null

     dtype: datetime64[ns]

     nullable: false

     checks:

       greater_than_or_equal_to: '2010-01-01 00:00:00'

       less_than_or_equal_to: '2012-01-01 00:00:00'

     unique: false

     coerce: false

     required: true

     regex: false

 checks: null

 index:

 - title: null

   description: null

   dtype: int64

   nullable: false

   checks:

     greater_than_or_equal_to: 0.0

     less_than_or_equal_to: 2.0

   name: null

   unique: false

   coerce: false

 coerce: true

 strict: false

 unique: null

 ordered: false

```

You can edit this yaml file to modify the schema. For example, you can specify

new column names under the `column` key, and the respective values map onto

key-word arguments in the [`Column`](index.html#pandera.schema_components.Column "pandera.schema_components.Column") class.

Note

Currently, only built-in [`Check`](index.html#pandera.checks.Check "pandera.checks.Check") methods are supported under the

`checks` key.

##### Write to JSON[#](#write-to-json "Permalink to this headline")

Finally, you can also write the schema object to a json file with `to\_json()`,

and you can then read it into memory with `from\_json()`. The

[`to\_json()`](index.html#pandera.schemas.DataFrameSchema.to_json "pandera.schemas.DataFrameSchema.to_json") and [`from\_json()`](index.html#pandera.schemas.DataFrameSchema.from_json "pandera.schemas.DataFrameSchema.from_json")

is a convenience method for this functionality.

```

# supply a file-like object, Path, or str to write to a file. If not

# specified, to\_yaml will output a yaml string.

json\_schema = schema.to\_json(indent=4)

print(json\_schema.replace(f"{pa.\_\_version\_\_}", "{PANDERA\_VERSION}"))

```

```

 {

     "schema_type": "dataframe",

     "version": "{PANDERA_VERSION}",

     "columns": {

         "column1": {

             "title": null,

             "description": null,

             "dtype": "int64",

             "nullable": false,

             "checks": {

                 "greater_than_or_equal_to": 5.0,

                 "less_than_or_equal_to": 20.0

             },

             "unique": false,

             "coerce": false,

             "required": true,

             "regex": false

         },

         "column2": {

             "title": null,

             "description": null,

             "dtype": "object",

             "nullable": false,

             "checks": null,

             "unique": false,

             "coerce": false,

             "required": true,

             "regex": false

         },

         "column3": {

             "title": null,

             "description": null,

             "dtype": "datetime64[ns]",

             "nullable": false,

             "checks": {

                 "greater_than_or_equal_to": "2010-01-01 00:00:00",

                 "less_than_or_equal_to": "2012-01-01 00:00:00"

             },

             "unique": false,

             "coerce": false,

             "required": true,

             "regex": false

         }

     },

     "checks": null,

     "index": [

         {

             "title": null,

             "description": null,

             "dtype": "int64",

             "nullable": false,

             "checks": {

                 "greater_than_or_equal_to": 0.0,

                 "less_than_or_equal_to": 2.0

             },

             "name": null,

             "unique": false,

             "coerce": false

         }

     ],

     "coerce": true,

     "strict": false,

     "unique": null,

     "ordered": false

 }

```

You can edit this json file to update the schema as needed, and then load

it back into a pandera schema object with `from\_json()` or

[`from\_json()`](index.html#pandera.schemas.DataFrameSchema.from_json "pandera.schemas.DataFrameSchema.from_json").

### Lazy Validation[#](#lazy-validation "Permalink to this headline")

*New in version 0.4.0*

By default, when you call the `validate` method on schema or schema component

objects, a [`SchemaError`](index.html#pandera.errors.SchemaError "pandera.errors.SchemaError") is raised as soon as one of the

assumptions specified in the schema is falsified. For example, for a

[`DataFrameSchema`](index.html#pandera.schemas.DataFrameSchema "pandera.schemas.DataFrameSchema") object, the following situations will raise an

exception:

* a column specified in the schema is not present in the dataframe.

* if `strict=True`, a column in the dataframe is not specified in the schema.

* the `data type` does not match.

* if `coerce=True`, the dataframe column cannot be coerced into the specified

`data type`.

* the [`Check`](index.html#pandera.checks.Check "pandera.checks.Check") specified in one of the columns returns `False` or

a boolean series containing at least one `False` value.

For example:

```

import pandas as pd

import pandera as pa

from pandera import Check, Column, DataFrameSchema

df = pd.DataFrame({"column": ["a", "b", "c"]})

schema = pa.DataFrameSchema({"column": Column(int)})

schema.validate(df)

```

```

Traceback (most recent call last):

...

SchemaError: expected series 'column' to have type int64, got object

```

For more complex cases, it is useful to see all of the errors raised during

the `validate` call so that you can debug the causes of errors on different

columns and checks. The `lazy` keyword argument in the `validate` method

of all schemas and schema components gives you the option of doing just this:

```

import pandas as pd

import pandera as pa

from pandera import Check, Column, DataFrameSchema

schema = pa.DataFrameSchema(

    columns={

        "int\_column": Column(int),

        "float\_column": Column(float, Check.greater\_than(0)),

        "str\_column": Column(str, Check.equal\_to("a")),

        "date\_column": Column(pa.DateTime),

    },

    strict=True

)

df = pd.DataFrame({

    "int\_column": ["a", "b", "c"],

    "float\_column": [0, 1, 2],

    "str\_column": ["a", "b", "d"],

    "unknown\_column": None,

})

schema.validate(df, lazy=True)

```

```

Traceback (most recent call last):

...

pandera.errors.SchemaErrors: A total of 5 schema errors were found.

Error Counts

------------

- column_not_in_schema: 1

- column_not_in_dataframe: 1

- schema_component_check: 3

Schema Error Summary

--------------------

                                                         failure_cases  n_failure_cases

schema_context  column       check

DataFrameSchema <NA>         column_in_dataframe         [date_column]                1

                             column_in_schema         [unknown_column]                1

Column          float_column dtype('float64')                  [int64]                1

                int_column   dtype('int64')                   [object]                1

                str_column   equal_to(a)                        [b, d]                2

Usage Tip

---------

Directly inspect all errors by catching the exception:

```

try:

    schema.validate(dataframe, lazy=True)

except SchemaErrors as err:

    err.failure_cases  # dataframe of schema errors

    err.data  # invalid dataframe

```

```

As you can see from the output above, a [`SchemaErrors`](index.html#pandera.errors.SchemaErrors "pandera.errors.SchemaErrors")

exception is raised with a summary of the error counts and failure cases

caught by the schema. You can also see from the **Usage Tip** that you can

catch these errors and inspect the failure cases in a more granular form:

```

try:

    schema.validate(df, lazy=True)

except pa.errors.SchemaErrors as err:

    print("Schema errors and failure cases:")

    print(err.failure\_cases)

    print("\nDataFrame object that failed validation:")

    print(err.data)

```

```

Schema errors and failure cases:

    schema_context        column                check check_number  \

0  DataFrameSchema          None     column_in_schema         None

1  DataFrameSchema          None  column_in_dataframe         None

2           Column    int_column       dtype('int64')         None

3           Column  float_column     dtype('float64')         None

4           Column  float_column      greater_than(0)            0

5           Column    str_column          equal_to(a)            0

6           Column    str_column          equal_to(a)            0

     failure_case index

0  unknown_column  None

1     date_column  None

2          object  None

3           int64  None

4               0     0

5               b     1

6               d     2

DataFrame object that failed validation:

  int_column  float_column str_column unknown_column

0          a             0          a           None

1          b             1          b           None

2          c             2          d           None

```

### Data Synthesis Strategies[#](#data-synthesis-strategies "Permalink to this headline")

*new in 0.6.0*

`pandera` provides a utility for generating synthetic data purely from

pandera schema or schema component objects. Under the hood, the schema metadata

is collected to create a data-generating strategy using

[hypothesis](https://hypothesis.readthedocs.io/en/latest/), which is a

property-based testing library.

#### Basic Usage[#](#basic-usage "Permalink to this headline")

Once you’ve defined a schema, it’s easy to generate examples:

```

import pandera as pa

schema = pa.DataFrameSchema(

    {

        "column1": pa.Column(int, pa.Check.eq(10)),

        "column2": pa.Column(float, pa.Check.eq(0.25)),

        "column3": pa.Column(str, pa.Check.eq("foo")),

    }

)

print(schema.example(size=3))

```

```

    column1  column2 column3

 0       10     0.25     foo

 1       10     0.25     foo

 2       10     0.25     foo

```

Note that here we’ve constrained the specific values in each column using

[`Check`](index.html#pandera.checks.Check "pandera.checks.Check") s in order to make the data generation process

deterministic for documentation purposes.

#### Usage in Unit Tests[#](#usage-in-unit-tests "Permalink to this headline")

The `example` method is available for all schemas and schema components, and

is primarily meant to be used interactively. It *could* be used in a script to

generate test cases, but `hypothesis` recommends against doing this and

instead using the `strategy` method to create a `hypothesis` strategy

that can be used in `pytest` unit tests.

```

import hypothesis

def processing\_fn(df):

    return df.assign(column4=df.column1 \* df.column2)

@hypothesis.given(schema.strategy(size=5))

def test\_processing\_fn(dataframe):

    result = processing\_fn(dataframe)

    assert "column4" in result

```

The above example is trivial, but you get the idea! Schema objects can create

a `strategy` that can then be collected by a [pytest](https://docs.pytest.org/en/latest/)

runner. We could also run the tests explicitly ourselves, or run it as a

`unittest.TestCase`. For more information on testing with hypothesis, see the

[hypothesis quick start guide](https://hypothesis.readthedocs.io/en/latest/quickstart.html#running-tests).

A more practical example involves using

[schema transformations](index.html#dataframe-schema-transformations). We can modify

the function above to make sure that `processing\_fn` actually outputs the

correct result:

```

out\_schema = schema.add\_columns({"column4": pa.Column(float)})

@pa.check\_output(out\_schema)

def processing\_fn(df):

    return df.assign(column4=df.column1 \* df.column2)

@hypothesis.given(schema.strategy(size=5))

def test\_processing\_fn(dataframe):

    processing\_fn(dataframe)

```

Now the `test\_processing\_fn` simply becomes an execution test, raising a

[`SchemaError`](index.html#pandera.errors.SchemaError "pandera.errors.SchemaError") if `processing\_fn` doesn’t add

`column4` to the dataframe.

#### Strategies and Examples from Schema Models[#](#strategies-and-examples-from-schema-models "Permalink to this headline")

You can also use the [class-based API](index.html#schema-models) to generate examples.

Here’s the equivalent schema model for the above examples:

```

from pandera.typing import Series, DataFrame

class InSchema(pa.SchemaModel):

    column1: Series[int] = pa.Field(eq=10)

    column2: Series[float] = pa.Field(eq=0.25)

    column3: Series[str] = pa.Field(eq="foo")

class OutSchema(InSchema):

    column4: Series[float]

@pa.check\_types

def processing\_fn(df: DataFrame[InSchema]) -> DataFrame[OutSchema]:

    return df.assign(column4=df.column1 \* df.column2)

@hypothesis.given(InSchema.strategy(size=5))

def test\_processing\_fn(dataframe):

    processing\_fn(dataframe)

```

#### Checks as Constraints[#](#checks-as-constraints "Permalink to this headline")

As you may have noticed in the first example, [`Check`](index.html#pandera.checks.Check "pandera.checks.Check") s

further constrain the data synthesized from a strategy. Without checks, the

`example` method would simply generate any value of the specified type. You

can specify multiple checks on a column and `pandera` should be able to

generate valid data under those constraints.

```

schema\_multiple\_checks = pa.DataFrameSchema({

    "column1": pa.Column(

        float, checks=[

            pa.Check.gt(0),

            pa.Check.lt(1e10),

            pa.Check.notin([-100, -10, 0]),

        ]

     )

})

for \_ in range(5):

    # generate 10 rows of the dataframe

    sample\_data = schema\_multiple\_checks.example(size=3)

    # validate the sampled data

    schema\_multiple\_checks(sample\_data)

```

One caveat here is that it’s up to you to define a set of checks that are

jointly satisfiable. If not, an `Unsatisfiable` exception will be raised:

```

schema\_multiple\_checks = pa.DataFrameSchema({

    "column1": pa.Column(

        float, checks=[

            # nonsensical constraints

            pa.Check.gt(0),

            pa.Check.lt(-10),

        ]

     )

})

schema\_multiple\_checks.example(size=3)

```

```

Traceback (most recent call last):

...

Unsatisfiable: Unable to satisfy assumptions of hypothesis example_generating_inner_function.

```

##### Check Strategy Chaining[#](#check-strategy-chaining "Permalink to this headline")

If you specify multiple checks for a particular column, this is what happens

under the hood:

* The first check in the list is the *base strategy*, which `hypothesis`

uses to generate data.

* All subsequent checks filter the values generated by the previous strategy

such that it fulfills the constraints of current check.

To optimize efficiency of the data-generation procedure, make sure to specify

the most restrictive constraint of a column as the *base strategy* and build

other constraints on top of it.

##### In-line Custom Checks[#](#in-line-custom-checks "Permalink to this headline")

One of the strengths of `pandera` is its flexibility with regard to defining

custom checks on the fly:

```

schema\_inline\_check = pa.DataFrameSchema({

    "col": pa.Column(str, pa.Check(lambda s: s.isin({"foo", "bar"})))

})

```

One of the disadvantages of this is that the fallback strategy is to simply

apply the check to the generated data, which can be highly inefficient. In this

case, `hypothesis` will generate strings and try to find examples of strings

that are in the set `{"foo", "bar"}`, which will be very slow and most likely

raise an `Unsatisfiable` exception. To get around this limitation, you can

register custom checks and define strategies that correspond to them.

#### Defining Custom Strategies[#](#defining-custom-strategies "Permalink to this headline")

All built-in [`Check`](index.html#pandera.checks.Check "pandera.checks.Check") s are associated with a data

synthesis strategy. You can define your own data synthesis strategies by using

the [extensions API](index.html#extensions) to register a custom check function with

a corresponding strategy.

### Extensions[#](#extensions "Permalink to this headline")

*new in 0.6.0*

#### Registering Custom Check Methods[#](#registering-custom-check-methods "Permalink to this headline")

One of the strengths of `pandera` is its flexibility in enabling you to

defining in-line custom checks on the fly:

```

import pandera as pa

# checks elements in a column/dataframe

element\_wise\_check = pa.Check(lambda x: x < 0, element\_wise=True)

# applies the check function to a dataframe/series

vectorized\_check = pa.Check(lambda series\_or\_df: series\_or\_df < 0)

```

However, there are two main disadvantages of schemas with inline custom checks:

1. they are not serializable with the [IO interface](index.html#schema-persistence).

2. you can’t use them to [synthesize data](index.html#data-synthesis-strategies)

because the checks are not associated with a `hypothesis` strategy.

`pandera` now offers a way to register custom checks so that they’re

available in the [`Check`](index.html#pandera.checks.Check "pandera.checks.Check") class as a check method. Here

let’s define a custom method that checks whether a pandas object contains

elements that lie within two values.

```

import pandera as pa

import pandera.extensions as extensions

import pandas as pd

@extensions.register\_check\_method(statistics=["min\_value", "max\_value"])

def is\_between(pandas\_obj, \*, min\_value, max\_value):

    return (min\_value <= pandas\_obj) & (pandas\_obj <= max\_value)

schema = pa.DataFrameSchema({

    "col": pa.Column(int, pa.Check.is\_between(min\_value=1, max\_value=10))

})

data = pd.DataFrame({"col": [1, 5, 10]})

print(schema(data))

```

```

   col

0    1

1    5

2   10

```

As you can see, a custom check’s first argument is a pandas series or dataframe

by default (more on that later), followed by keyword-only arguments, specified

with the `\*` syntax.

The [`register\_check\_method()`](index.html#pandera.extensions.register_check_method "pandera.extensions.register_check_method") requires you to

explicitly name the check `statistics` via the keyword argument, which are

essentially the constraints placed by the check on the pandas data structure.

#### Specifying a Check Strategy[#](#specifying-a-check-strategy "Permalink to this headline")

To specify a check strategy with your custom check, you’ll need to install the

[strategies extension](index.html#installation). First let’s look at a trivially simple

example, where the check verifies whether a column is equal to a certain value:

```

def custom\_equals(pandas\_obj, \*, value):

    return pandas\_obj == value

```

The corresponding strategy for this check would be:

```

from typing import Optional

import hypothesis

import pandera.strategies as st

def equals\_strategy(

    pandera\_dtype: pa.DataType,

    strategy: Optional[st.SearchStrategy] = None,

    \*,

    value,

):

    if strategy is None:

        return st.pandas\_dtype\_strategy(

            pandera\_dtype, strategy=hypothesis.strategies.just(value),

        )

    return strategy.filter(lambda x: x == value)

```

As you may notice, the `pandera` strategy interface is has two arguments

followed by keyword-only arguments that match the check function keyword-only

check statistics. The `pandera\_dtype` positional argument is useful for

ensuring the correct data type. In the above example, we’re using the

[`pandas\_dtype\_strategy()`](index.html#pandera.strategies.pandas_dtype_strategy "pandera.strategies.pandas_dtype_strategy") strategy to make sure the

generated `value` is of the correct data type.

The optional `strategy` argument allows us to use the check strategy as a

*base strategy* or a *chained strategy*. There’s a detail that we’re

responsible for implementing in the strategy function body: we need to handle

two cases to account for [strategy chaining](index.html#check-strategy-chaining):

1. when the strategy function is being used as a *base strategy*, i.e. when

`strategy` is `None`

2. when the strategy function is being chained from a previously-defined

strategy, i.e. when `strategy` is not `None`.

Finally, to register the custom check with the strategy, use the

[`register\_check\_method()`](index.html#pandera.extensions.register_check_method "pandera.extensions.register_check_method") decorator:

```

@extensions.register\_check\_method(

    statistics=["value"], strategy=equals\_strategy

)

def custom\_equals(pandas\_obj, \*, value):

    return pandas\_obj == value

```

Let’s unpack what’s going in here. The `custom\_equals` function only has

a single statistic, which is the `value` argument, which we’ve also specified

in [`register\_check\_method()`](index.html#pandera.extensions.register_check_method "pandera.extensions.register_check_method"). This means that the

associated check strategy must match its keyword-only arguments.

Going back to our `is\_between` function example, here’s what the strategy

would look like:

```

def in\_between\_strategy(

    pandera\_dtype: pa.DataType,

    strategy: Optional[st.SearchStrategy] = None,

    \*,

    min\_value,

    max\_value

):

    if strategy is None:

        return st.pandas\_dtype\_strategy(

            pandera\_dtype,

            min\_value=min\_value,

            max\_value=max\_value,

            exclude\_min=False,

            exclude\_max=False,

        )

    return strategy.filter(lambda x: min\_value <= x <= max\_value)

@extensions.register\_check\_method(

    statistics=["min\_value", "max\_value"],

    strategy=in\_between\_strategy,

)

def is\_between\_with\_strat(pandas\_obj, \*, min\_value, max\_value):

    return (min\_value <= pandas\_obj) & (pandas\_obj <= max\_value)

```

#### Check Types[#](#check-types "Permalink to this headline")

The extensions module also supports registering

[element-wise](index.html#elementwise-checks) and [groupby](index.html#column-check-groups)

checks.

##### Element-wise Checks[#](#element-wise-checks "Permalink to this headline")

```

@extensions.register\_check\_method(

    statistics=["val"],

    check\_type="element\_wise",

)

def element\_wise\_equal\_check(element, \*, val):

    return element == val

```

Note that the first argument of `element\_wise\_equal\_check` is a single

element in the column or dataframe.

##### Groupby Checks[#](#groupby-checks "Permalink to this headline")

In this groupby check, we’re verifying that the values of one column for

`group\_a` are, on average, greater than those of `group\_b`:

```

from typing import Dict

@extensions.register\_check\_method(

    statistics=["group\_a", "group\_b"],

    check\_type="groupby",

)

def groupby\_check(dict\_groups: Dict[str, pd.Series], \*, group\_a, group\_b):

    return dict\_groups[group\_a].mean() > dict\_groups[group\_b].mean()

data = pd.DataFrame({

    "values": [20, 10, 1, 15],

    "groups": list("xxyy"),

})

schema = pa.DataFrameSchema({

    "values": pa.Column(

        int,

        pa.Check.groupby\_check(group\_a="x", group\_b="y", groupby="groups"),

    ),

    "groups": pa.Column(str),

})

print(schema(data))

```

```

   values groups

0      20      x

1      10      x

2       1      y

3      15      y

```

#### Registered Custom Checks with the Class-based API[#](#registered-custom-checks-with-the-class-based-api "Permalink to this headline")

Since registered checks are part of the [`Check`](index.html#pandera.checks.Check "pandera.checks.Check") namespace,

you can also use custom checks with the [class-based API](index.html#schema-models):

```

from pandera.typing import Series

class Schema(pa.SchemaModel):

    col1: Series[str] = pa.Field(custom\_equals="value")

    col2: Series[int] = pa.Field(is\_between={"min\_value": 0, "max\_value": 10})

data = pd.DataFrame({

    "col1": ["value"] \* 5,

    "col2": range(5)

})

print(Schema.validate(data))

```

```

    col1  col2

0  value     0

1  value     1

2  value     2

3  value     3

4  value     4

```

DataFrame checks can be attached by using the [Config](index.html#schema-model-config) class. Any field names that

do not conflict with existing fields of [`BaseConfig`](index.html#pandera.model.BaseConfig "pandera.model.BaseConfig") and do not start

with an underscore (`\_`) are interpreted as the name of registered checks. If the value

is a tuple or dict, it is interpreted as the positional or keyword arguments of the check, and

as the first argument otherwise.

For example, to register zero, one, and two statistic dataframe checks one could do the following:

```

import pandera as pa

import pandera.extensions as extensions

import numpy as np

import pandas as pd

@extensions.register\_check\_method()

def is\_small(df):

    return sum(df.shape) < 1000

@extensions.register\_check\_method(statistics=["fraction"])

def total\_missing\_fraction\_less\_than(df, \*, fraction: float):

    return (1 - df.count().sum().item() / df.apply(len).sum().item()) < fraction

@extensions.register\_check\_method(statistics=["col\_a", "col\_b"])

def col\_mean\_a\_greater\_than\_b(df, \*, col\_a: str, col\_b: str):

    return df[col\_a].mean() > df[col\_b].mean()

from pandera.typing import Series

class Schema(pa.SchemaModel):

    col1: Series[float] = pa.Field(nullable=True, ignore\_na=False)

    col2: Series[float] = pa.Field(nullable=True, ignore\_na=False)

    class Config:

        is\_small = ()

        total\_missing\_fraction\_less\_than = 0.6

        col\_mean\_a\_greater\_than\_b = {"col\_a": "col2", "col\_b": "col1"}

data = pd.DataFrame({

    "col1": [float('nan')] \* 3 + [0.5, 0.3, 0.1],

    "col2": np.arange(6.),

})

print(Schema.validate(data))

```

```

   col1  col2

0   NaN   0.0

1   NaN   1.0

2   NaN   2.0

3   0.5   3.0

4   0.3   4.0

5   0.1   5.0

```

### Data Format Conversion[#](#data-format-conversion "Permalink to this headline")

*new in 0.9.0*

The class-based API provides configuration options for converting data to/from

supported serialization formats in the context of

[`check\_types()`](index.html#pandera.decorators.check_types "pandera.decorators.check_types") -decorated functions.

Note

Currently, `pandera.typing.pandas.DataFrame` is the only data

type that supports this feature.

Consider this simple example:

```

import pandera as pa

from pandera.typing import DataFrame, Series

class InSchema(pa.SchemaModel):

    str\_col: Series[str] = pa.Field(unique=True, isin=[\*"abcd"])

    int\_col: Series[int]

class OutSchema(InSchema):

    float\_col: pa.typing.Series[float]

@pa.check\_types

def transform(df: DataFrame[InSchema]) -> DataFrame[OutSchema]:

    return df.assign(float\_col=1.1)

```

With the schema type annotations and

[`check\_types()`](index.html#pandera.decorators.check_types "pandera.decorators.check_types") decorator, the `transform`

function validates DataFrame inputs and outputs according to the `InSchema`

and `OutSchema` definitions.

But what if your input data is serialized in parquet format, and you want to

read it into memory, validate the DataFrame, and then pass it to a downstream

function for further analysis? Similarly, what if you want the output of

`transform` to be a list of dictionary records instead of a pandas DataFrame?

#### The `to/from\_format` Configuration Options[#](#the-to-from-format-configuration-options "Permalink to this headline")

To easily fulfill the use cases described above, you can implement the

read/write logic by hand, or you can configure schemas to do so. We can first

define a subclass of `InSchema` with additional configuration so that our

`transform` function can read data directly from parquet files or buffers:

```

class InSchemaParquet(InSchema):

    class Config:

        from\_format = "parquet"

```

Then, we define subclass of `OutSchema` to specify that `transform`

should output a list of dictionaries representing the rows of the output

dataframe.

```

class OutSchemaDict(OutSchema):

    class Config:

        to\_format = "dict"

        to\_format\_kwargs = {"orient": "records"}

```

Note that the `{to/from}\_format\_kwargs` configuration option should be

supplied with a dictionary of key-word arguments to be passed into the

respective pandas `to\_{format}` method.

Finally, we redefine our `transform` function:

```

@pa.check\_types

def transform(df: DataFrame[InSchemaParquet]) -> DataFrame[OutSchemaDict]:

    return df.assign(float\_col=1.1)

```

We can test this out using a buffer to store the parquet file.

Note

A string or path-like object representing the filepath to a parquet file

would also be a valid input to `transform`.

```

import io

import json

buffer = io.BytesIO()

data = pd.DataFrame({"str\_col": [\*"abc"], "int\_col": range(3)})

data.to\_parquet(buffer)

buffer.seek(0)

dict\_output = transform(buffer)

print(json.dumps(dict\_output, indent=4))

```

```

[

    {

        "str_col": "a",

        "int_col": 0,

        "float_col": 1.1

    },

    {

        "str_col": "b",

        "int_col": 1,

        "float_col": 1.1

    },

    {

        "str_col": "c",

        "int_col": 2,

        "float_col": 1.1

    }

]

```

#### Takeaway[#](#takeaway "Permalink to this headline")

Data Format Conversion using the `{to/from}\_format` configuration option

can modify the behavior of [`check\_types()`](index.html#pandera.decorators.check_types "pandera.decorators.check_types") -decorated

functions to convert input data from a particular serialization format into

a dataframe. Additionally, you can convert the output data from a dataframe to

potentially another format.

This dovetails well with the [FastAPI Integration](index.html#fastapi-integration)

for validating the inputs and outputs of app endpoints.

### Supported DataFrame Libraries[#](#supported-dataframe-libraries "Permalink to this headline")

Pandera started out as a pandas-specific dataframe validation library, and

moving forward its core functionality will continue to support pandas. However,

pandera’s adoption has resulted in the realization that it can be a much more

powerful tool by supporting other dataframe-like formats.

#### Domain-specific Data Validation[#](#domain-specific-data-validation "Permalink to this headline")

The pandas ecosystem provides support for

[domain-specific data manipulation](https://pandas.pydata.org/docs/ecosystem.html#domain-specific),

and by extension pandera can provide access to data types, methods, and data

container types specific to these libraries.

| [GeoPandas](index.html#supported-lib-geopandas) | An extension of pandas that adds geospatial data processing capabilities. |

##### Data Validation with GeoPandas[#](#data-validation-with-geopandas "Permalink to this headline")

*new in 0.9.0*

[GeoPandas](https://geopandas.org/en/stable/docs.html) is an extension of Pandas that adds

support for geospatial data. You can use pandera to validate `GeoDataFrame()`

and `GeoSeries()` objects directly. First, install

`pandera` with the `geopandas` extra:

```

pip install pandera[geopandas]

```

Then you can use pandera schemas to validate geodataframes. In the example

below we’ll use the [class-based API](index.html#schema-models) to define a

`SchemaModel` for validation.

```

import geopandas as gpd

import pandas as pd

import pandera as pa

from shapely.geometry import Polygon

geo\_schema = pa.DataFrameSchema({

    "geometry": pa.Column("geometry"),

    "region": pa.Column(str),

})

geo\_df = gpd.GeoDataFrame({

    "geometry": [

        Polygon(((0, 0), (0, 1), (1, 1), (1, 0))),

        Polygon(((0, 0), (0, -1), (-1, -1), (-1, 0)))

    ],

    "region": ["NA", "SA"]

})

print(geo\_schema.validate(geo\_df))

```

```

                                            geometry region

0  POLYGON ((0.00000 0.00000, 0.00000 1.00000, 1....     NA

1  POLYGON ((0.00000 0.00000, 0.00000 -1.00000, -...     SA

```

You can also use the `GeometryDtype` data type in either instantiated or

un-instantiated form:

```

geo\_schema = pa.DataFrameSchema({

    "geometry": pa.Column(gpd.array.GeometryDtype),

    # or

    "geometry": pa.Column(gpd.array.GeometryDtype()),

})

```

If you want to validate-on-instantiation, you can use the

`GeoDataFrame` generic type with the

schema model defined above:

```

from pandera.typing import Series

from pandera.typing.geopandas import GeoDataFrame, GeoSeries

class Schema(pa.SchemaModel):

    geometry: GeoSeries

    region: Series[str]

# create a geodataframe that's validated on object initialization

df = GeoDataFrame[Schema](

    {

        'geometry': [

            Polygon(((0, 0), (0, 1), (1, 1), (1, 0))),

            Polygon(((0, 0), (0, -1), (-1, -1), (-1, 0)))

        ],

        'region': ['NA','SA']

    }

)

print(df)

```

```

                                            geometry region

0  POLYGON ((0.00000 0.00000, 0.00000 1.00000, 1....     NA

1  POLYGON ((0.00000 0.00000, 0.00000 -1.00000, -...     SA

```

#### Scaling Up Data Validation[#](#scaling-up-data-validation "Permalink to this headline")

Pandera provides multiple ways of scaling up data validation to dataframes

that don’t fit into memory. Fortunately, pandera doesn’t have to re-invent

the wheel. Standing on shoulders of giants, it integrates with the existing

ecosystem of libraries that allow you to perform validations on out-of-memory

dataframes.

| [Dask](index.html#scaling-dask) | Apply pandera schemas to Dask dataframe partitions. |

| [Fugue](index.html#scaling-fugue) | Apply pandera schemas to distributed dataframe partitions with Fugue. |

| [Koalas](index.html#scaling-koalas) *[Deprecated]* | A pandas drop-in replacement, distributed using a Spark backend. |

| [Pyspark](index.html#scaling-pyspark) | Exposes a `pyspark.pandas` module, distributed using a Spark backend. |

| [Modin](index.html#scaling-modin) | A pandas drop-in replacement, distributed using a Ray or Dask backend. |

##### Data Validation with Dask[#](#data-validation-with-dask "Permalink to this headline")

*new in 0.8.0*

[Dask](https://docs.dask.org/en/latest/dataframe.html) is a distributed

compute framework that offers a pandas-like dataframe API.

You can use pandera to validate `DataFrame()`

and `Series()` objects directly. First, install

`pandera` with the `dask` extra:

```

pip install pandera[dask]

```

Then you can use pandera schemas to validate dask dataframes. In the example

below we’ll use the [class-based API](index.html#schema-models) to define a

`SchemaModel` for validation.

```

import dask.dataframe as dd

import pandas as pd

import pandera as pa

from pandera.typing.dask import DataFrame, Series

class Schema(pa.SchemaModel):

    state: Series[str]

    city: Series[str]

    price: Series[int] = pa.Field(in\_range={"min\_value": 5, "max\_value": 20})

ddf = dd.from\_pandas(

    pd.DataFrame(

        {

            'state': ['FL','FL','FL','CA','CA','CA'],

            'city': [

                'Orlando',

                'Miami',

                'Tampa',

                'San Francisco',

                'Los Angeles',

                'San Diego',

            ],

            'price': [8, 12, 10, 16, 20, 18],

        }

    ),

    npartitions=2

)

pandera\_ddf = Schema(ddf)

print(pandera\_ddf)

```

```

Dask DataFrame Structure:

                state    city  price

npartitions=2

0              object  object  int64

3                 ...     ...    ...

5                 ...     ...    ...

Dask Name: validate, 2 graph layers

```

As you can see, passing the dask dataframe into `Schema` will produce

another dask dataframe which hasn’t been evaluated yet. What this means is

that pandera will only validate when the dask graph is evaluated.

```

print(pandera\_ddf.compute())

```

```

  state           city  price

0    FL        Orlando      8

1    FL          Miami     12

2    FL          Tampa     10

3    CA  San Francisco     16

4    CA    Los Angeles     20

5    CA      San Diego     18

```

You can also use the `check\_types()` decorator to validate

dask dataframes at runtime:

```

@pa.check\_types

def function(ddf: DataFrame[Schema]) -> DataFrame[Schema]:

    return ddf[ddf["state"] == "CA"]

print(function(ddf).compute())

```

```

  state           city  price

3    CA  San Francisco     16

4    CA    Los Angeles     20

5    CA      San Diego     18

```

And of course, you can use the object-based API to validate dask dataframes:

```

schema = pa.DataFrameSchema({

    "state": pa.Column(str),

    "city": pa.Column(str),

    "price": pa.Column(int, pa.Check.in\_range(min\_value=5, max\_value=20))

})

print(schema(ddf).compute())

```

```

  state           city  price

0    FL        Orlando      8

1    FL          Miami     12

2    FL          Tampa     10

3    CA  San Francisco     16

4    CA    Los Angeles     20

5    CA      San Diego     18

```

##### Data Validation with Fugue[#](#data-validation-with-fugue "Permalink to this headline")

Validation on big data comes in two forms. The first is performing one set of

validations on data that doesn’t fit in memory. The second happens when a large dataset

is comprised of multiple groups that require different validations. In pandas semantics,

this would be the equivalent of a `groupby-validate` operation. This section will cover

using `pandera` for both of these scenarios.

`Pandera` has support for `Spark` and `Dask` DataFrames through `Modin` and

`PySpark Pandas`. Another option for running `pandera` on top of native `Spark`

or `Dask` engines is [Fugue](https://github.com/fugue-project/fugue/) . `Fugue` is

an open source abstraction layer that ports `Python`, `pandas`, and `SQL` code to

`Spark` and `Dask`. Operations will be applied on DataFrames natively, minimizing

overhead.

###### What is Fugue?[#](#what-is-fugue "Permalink to this headline")

`Fugue` serves as an interface to distributed computing. Because of its non-invasive design,

existing `Python` code can be scaled to a distributed setting without significant changes.

To run the example, `Fugue` needs to installed separately. Using pip:

```

pip install fugue[spark]

```

This will also install `PySpark` because of the `spark` extra. `Dask` is available

with the `dask` extra.

###### Example[#](#example "Permalink to this headline")

In this example, a pandas `DataFrame` is created with `state`, `city` and `price`

columns. `Pandera` will be used to validate that the `price` column values are within

a certain range.

```

import pandas as pd

data = pd.DataFrame(

    {

        'state': ['FL','FL','FL','CA','CA','CA'],

        'city': [

            'Orlando', 'Miami', 'Tampa', 'San Francisco', 'Los Angeles', 'San Diego'

        ],

        'price': [8, 12, 10, 16, 20, 18],

    }

)

print(data)

```

```

  state           city  price

0    FL        Orlando      8

1    FL          Miami     12

2    FL          Tampa     10

3    CA  San Francisco     16

4    CA    Los Angeles     20

5    CA      San Diego     18

```

Validation is then applied using pandera. A `price\_validation` function is

created that runs the validation. None of this will be new.

```

from pandera import Column, DataFrameSchema, Check

price\_check = DataFrameSchema(

    {"price": Column(int, Check.in\_range(min\_value=5,max\_value=20))}

)

def price\_validation(data:pd.DataFrame) -> pd.DataFrame:

    return price\_check.validate(data)

```

The `transform` function in `Fugue` is the easiest way to use `Fugue` with existing `Python`

functions as seen in the following code snippet. The first two arguments are the `DataFrame` and

function to apply. The keyword argument `schema` is required because schema is strictly enforced

in distributed settings. Here, the `schema` is simply \* because no new columns are added.

The last part of the `transform` function is the `engine`. Here, a `SparkSession` object

is used to run the code on top of `Spark`. For Dask, users can pass a string `"dask"` or

can pass a Dask Client. Passing nothing uses the default pandas-based engine. Because we

passed a SparkSession in this example, the output is a Spark DataFrame.

```

from fugue import transform

from pyspark.sql import SparkSession

spark = SparkSession.builder.getOrCreate()

spark\_df = transform(data, price\_validation, schema="\*", engine=spark)

spark\_df.show()

```

```

+-----+-------------+-----+

|state|         city|price|

+-----+-------------+-----+

|   FL|      Orlando|    8|

|   FL|        Miami|   12|

|   FL|        Tampa|   10|

|   CA|San Francisco|   16|

|   CA|  Los Angeles|   20|

|   CA|    San Diego|   18|

+-----+-------------+-----+

```

###### Validation by Partition[#](#validation-by-partition "Permalink to this headline")

There is an interesting use case that arises with bigger datasets. Frequently, there are logical

groupings of data that require different validations. In the earlier sample data, the

price range for the records with `state` FL is lower than the range for the `state` CA.

Two [`DataFrameSchema`](index.html#pandera.schemas.DataFrameSchema "pandera.schemas.DataFrameSchema") will be created to reflect this. Notice their ranges

for the [`Check`](index.html#pandera.checks.Check "pandera.checks.Check") differ.

```

price\_check\_FL = DataFrameSchema({

    "price": Column(int, Check.in\_range(min\_value=7,max\_value=13)),

})

price\_check\_CA = DataFrameSchema({

    "price": Column(int, Check.in\_range(min\_value=15,max\_value=21)),

})

price\_checks = {'CA': price\_check\_CA, 'FL': price\_check\_FL}

```

A slight modification is needed to our `price\_validation` function. `Fugue` will partition

the whole dataset into multiple pandas `DataFrames`. Think of this as a `groupby`. By the

time `price\_validation` is used, it only contains the data for one `state`. The appropriate

`DataFrameSchema` is pulled and then applied.

To partition our data by `state`, all we need to do is pass it into the `transform` function

through the `partition` argument. This splits up the data across different workers before they

each run the `price\_validation` function. Again, this is like a groupby-validation.

```

def price\_validation(df:pd.DataFrame) -> pd.DataFrame:

    location = df['state'].iloc[0]

    check = price\_checks[location]

    check.validate(df)

    return df

spark\_df = transform(data,

          price\_validation,

          schema="\*",

          partition=dict(by="state"),

          engine=spark)

spark\_df.show()

```

```

SparkDataFrame

state:str|city:str                                                 |price:long

---------+---------------------------------------------------------+----------

CA       |San Francisco                                            |16

CA       |Los Angeles                                              |20

CA       |San Diego                                                |18

FL       |Orlando                                                  |8

FL       |Miami                                                    |12

FL       |Tampa                                                    |10

Total count: 6

```

Note

Because operations in a distributed setting are applied per partition, statistical

validators will be applied on each partition rather than the global dataset. If no

partitioning scheme is specified, `Spark` and `Dask` use default partitions. Be

careful about using operations like mean, min, and max without partitioning beforehand.

All row-wise validations scale well with this set-up.

###### Returning Errors[#](#returning-errors "Permalink to this headline")

`Pandera` will raise a `SchemaError` by default that gets buried by the Spark error

messages. To return the errors as a DataFrame, we use can use the following approach. If

there are no errors in the data, it will just return an empty DataFrame.

To keep the errors for each partition, you can attach the partition key as a column in

the returned DataFrame.

```

from pandera.errors import SchemaErrors

out\_schema = "schema\_context:str, column:str, check:str, \

check\_number:int, failure\_case:str, index:int"

out\_columns = ["schema\_context", "column", "check",

"check\_number", "failure\_case", "index"]

price\_check = DataFrameSchema(

    {"price": Column(int, Check.in\_range(min\_value=12,max\_value=20))}

)

def price\_validation(data:pd.DataFrame) -> pd.DataFrame:

    try:

        price\_check.validate(data, lazy=True)

        return pd.DataFrame(columns=out\_columns)

    except SchemaErrors as err:

        return err.failure\_cases

transform(data, price\_validation, schema=out\_schema, engine=spark).show()

```

```

+--------------+------+----------------+------------+------------+-----+

|schema_context|column|           check|check_number|failure_case|index|

+--------------+------+----------------+------------+------------+-----+

|        Column| price|in_range(12, 20)|           0|           8|    0|

|        Column| price|in_range(12, 20)|           0|          10|    0|

+--------------+------+----------------+------------+------------+-----+

```

##### Data Validation with Koalas[#](#data-validation-with-koalas "Permalink to this headline")

Note

Koalas has been deprecated since version *0.10.0*. Please refer to the

[pyspark page](index.html#scaling-pyspark) for validating pyspark dataframes.

##### Data Validation with Pyspark ⭐️ (New)[#](#data-validation-with-pyspark-new "Permalink to this headline")

*new in 0.10.0*

[Pyspark](https://spark.apache.org/docs/3.2.0/api/python/index.html) is a

distributed compute framework that offers a pandas drop-in replacement dataframe

implementation via the [pyspark.pandas API](https://spark.apache.org/docs/3.2.0/api/python/reference/pyspark.pandas/index.html) .

You can use pandera to validate `DataFrame()`

and `Series()` objects directly. First, install

`pandera` with the `pyspark` extra:

```

pip install pandera[pyspark]

```

Then you can use pandera schemas to validate pyspark dataframes. In the example

below we’ll use the [class-based API](index.html#schema-models) to define a

`SchemaModel` for validation.

```

import pyspark.pandas as ps

import pandas as pd

import pandera as pa

from pandera.typing.pyspark import DataFrame, Series

class Schema(pa.SchemaModel):

    state: Series[str]

    city: Series[str]

    price: Series[int] = pa.Field(in\_range={"min\_value": 5, "max\_value": 20})

# create a pyspark.pandas dataframe that's validated on object initialization

df = DataFrame[Schema](

    {

        'state': ['FL','FL','FL','CA','CA','CA'],

        'city': [

            'Orlando',

            'Miami',

            'Tampa',

            'San Francisco',

            'Los Angeles',

            'San Diego',

        ],

        'price': [8, 12, 10, 16, 20, 18],

    }

)

print(df)

```

```

  state           city  price

0    FL        Orlando      8

1    FL          Miami     12

2    FL          Tampa     10

3    CA  San Francisco     16

4    CA    Los Angeles     20

5    CA      San Diego     18

```

You can also use the `check\_types()` decorator to validate

pyspark pandas dataframes at runtime:

```

@pa.check\_types

def function(df: DataFrame[Schema]) -> DataFrame[Schema]:

    return df[df["state"] == "CA"]

print(function(df))

```

```

  state           city  price

3    CA  San Francisco     16

4    CA    Los Angeles     20

5    CA      San Diego     18

```

And of course, you can use the object-based API to validate dask dataframes:

```

schema = pa.DataFrameSchema({

    "state": pa.Column(str),

    "city": pa.Column(str),

    "price": pa.Column(int, pa.Check.in\_range(min\_value=5, max\_value=20))

})

print(schema(df))

```

```

  state           city  price

0    FL        Orlando      8

1    FL          Miami     12

2    FL          Tampa     10

3    CA  San Francisco     16

4    CA    Los Angeles     20

5    CA      San Diego     18

```

##### Data Validation with Modin[#](#data-validation-with-modin "Permalink to this headline")

*new in 0.8.0*

[Modin](https://modin.readthedocs.io/en/latest/) is a distributed

compute framework that offers a pandas drop-in replacement dataframe

implementation. You can use pandera to validate `DataFrame()`

and `Series()` objects directly. First, install

`pandera` with the `dask` extra:

```

pip install pandera[modin]       # installs both ray and dask backends

pip install pandera[modin-ray]   # only ray backend

pip install pandera[modin-dask]  # only dask backend

```

Then you can use pandera schemas to validate modin dataframes. In the example

below we’ll use the [class-based API](index.html#schema-models) to define a

`SchemaModel` for validation.

```

import modin.pandas as pd

import pandas as pd

import pandera as pa

from pandera.typing.modin import DataFrame, Series

class Schema(pa.SchemaModel):

    state: Series[str]

    city: Series[str]

    price: Series[int] = pa.Field(in\_range={"min\_value": 5, "max\_value": 20})

# create a modin dataframe that's validated on object initialization

df = DataFrame[Schema](

    {

        'state': ['FL','FL','FL','CA','CA','CA'],

        'city': [

            'Orlando',

            'Miami',

            'Tampa',

            'San Francisco',

            'Los Angeles',

            'San Diego',

        ],

        'price': [8, 12, 10, 16, 20, 18],

    }

)

print(df)

```

```

  state           city  price

0    FL        Orlando      8

1    FL          Miami     12

2    FL          Tampa     10

3    CA  San Francisco     16

4    CA    Los Angeles     20

5    CA      San Diego     18

```

You can also use the `check\_types()` decorator to validate

modin dataframes at runtime:

```

@pa.check\_types

def function(df: DataFrame[Schema]) -> DataFrame[Schema]:

    return df[df["state"] == "CA"]

print(function(df))

```

```

  state           city  price

3    CA  San Francisco     16

4    CA    Los Angeles     20

5    CA      San Diego     18

```

And of course, you can use the object-based API to validate dask dataframes:

```

schema = pa.DataFrameSchema({

    "state": pa.Column(str),

    "city": pa.Column(str),

    "price": pa.Column(int, pa.Check.in\_range(min\_value=5, max\_value=20))

})

print(schema(df))

```

```

  state           city  price

0    FL        Orlando      8

1    FL          Miami     12

2    FL          Tampa     10

3    CA  San Francisco     16

4    CA    Los Angeles     20

5    CA      San Diego     18

```

Note

Don’t see a library that you want supported? Check out the

[github issues](https://github.com/pandera-dev/pandera/issues) to see if

that library is in the roadmap. If it isn’t, open up a

[new issue](https://github.com/pandera-dev/pandera/issues/new?assignees=&labels=enhancement&template=feature_request.md&title=)

to add support for it!

### Integrations[#](#integrations "Permalink to this headline")

Pandera ships with integrations with other tools in the Python ecosystem, with

the goal of interoperating with libraries that you know and love.

| [FastAPI](index.html#fastapi-integration) | Use pandera SchemaModels in your FastAPI app |

| [Frictionless](index.html#frictionless-integration) | Convert frictionless schemas to pandera schemas |

| [Hypothesis](index.html#data-synthesis-strategies) | Use the hypothesis library to generate valid data under your schema’s constraints. |

| [Mypy](index.html#mypy-integration) | Type-lint your pandas and pandera code with mypy for static type safety [experimental 🧪] |

| [Pydantic](index.html#pydantic-integration) | Use pandera SchemaModels when defining your pydantic BaseModels |

#### FastAPI[#](#fastapi "Permalink to this headline")

*new in 0.9.0*

Since both FastAPI and Pandera integrates seamlessly with Pydantic, you can

use the [`SchemaModel`](index.html#pandera.model.SchemaModel "pandera.model.SchemaModel") types to validate incoming

or outgoing data with respect to your API endpoints.

##### Using SchemaModels to Validate Endpoint Inputs and Outputs[#](#using-schemamodels-to-validate-endpoint-inputs-and-outputs "Permalink to this headline")

Suppose we want to process transactions, where each transaction has an

`id` and `cost`. We can model this with a pandera schema model:

```

# pylint: skip-file

from typing import Optional

from pydantic import BaseModel, Field

import pandera as pa

class Transactions(pa.SchemaModel):

    id: pa.typing.Series[int]

    cost: pa.typing.Series[float] = pa.Field(ge=0, le=1000)

    class Config:

        coerce = True

```

Also suppose that we expect our endpoint to add a `name` to the transaction

data:

```

class TransactionsOut(Transactions):

    id: pa.typing.Series[int]

    cost: pa.typing.Series[float]

    name: pa.typing.Series[str]

```

Let’s also assume that the output of the endpoint should be a list of dictionary

records containing the named transactions data. We can do this easily with the

`to\_format` option in the schema model [`BaseConfig`](index.html#pandera.model.BaseConfig "pandera.typing.config.BaseConfig").

```

class TransactionsDictOut(TransactionsOut):

    class Config:

        to\_format = "dict"

        to\_format\_kwargs = {"orient": "records"}

```

Note that the `to\_format\_kwargs` is a dictionary of key-word arguments

to be passed into the respective pandas `to\_{format}` method.

Next we’ll create a FastAPI app and define a `/transactions/` POST endpoint:

```

from fastapi import FastAPI, File

from pandera.typing import DataFrame

app = FastAPI()

@app.post("/transactions/", response\_model=DataFrame[TransactionsDictOut])

def create\_transactions(transactions: DataFrame[Transactions]):

    output = transactions.assign(name="foo")

    ...  # do other stuff, e.g. update backend database with transactions

    return output

```

##### Reading File Uploads[#](#reading-file-uploads "Permalink to this headline")

Similar to the `TransactionsDictOut` example to convert dataframes to a

particular format as an endpoint response, pandera also provides a

`from\_format` schema model configuration option to read a dataframe from

a particular serialization format.

```

class TransactionsParquet(Transactions):

    class Config:

        from\_format = "parquet"

```

Let’s also define a response model for the `/file/` upload endpoint:

```

class TransactionsJsonOut(TransactionsOut):

    class Config:

        to\_format = "json"

        to\_format\_kwargs = {"orient": "records"}

class ResponseModel(BaseModel):

    filename: str

    df: pa.typing.DataFrame[TransactionsJsonOut]

```

In the next example, we use the pandera

[`UploadFile`](index.html#pandera.typing.fastapi.UploadFile "pandera.typing.fastapi.UploadFile") type to upload a parquet file

to the `/file/` POST endpoint and return a response containing the filename

and the modified data in json format.

```

from pandera.typing.fastapi import UploadFile

@app.post("/file/", response\_model=ResponseModel)

def create\_upload\_file(

    file: UploadFile[DataFrame[TransactionsParquet]] = File(...),

):

    return {

        "filename": file.filename,

        "df": file.data.assign(name="foo"),

    }

```

Pandera’s [`UploadFile`](index.html#pandera.typing.fastapi.UploadFile "pandera.typing.fastapi.UploadFile") type is a subclass of FastAPI’s

[UploadFile](https://fastapi.tiangolo.com/tutorial/request-files/?h=uploadfile#uploadfile)

but it exposes a `.data` property containing the pandera-validated dataframe.

##### Takeaway[#](#takeaway "Permalink to this headline")

With the FastAPI and Pandera integration, you can use Pandera

[`SchemaModel`](index.html#pandera.model.SchemaModel "pandera.model.SchemaModel") types to validate the dataframe inputs

and outputs of your FastAPI endpoints.

#### Reading Third-Party Schema[#](#reading-third-party-schema "Permalink to this headline")

*new in 0.7.0*

Pandera now accepts schema from other data validation frameworks. This requires

a pandera installation with the `io` extension; please see the

[installation](index.html#installation) instructions for more details.

##### Frictionless Data Schema[#](#frictionless-data-schema "Permalink to this headline")

Note

Please see the

[Frictionless schema](https://specs.frictionlessdata.io/table-schema/)

documentation for more information on this standard.

pandera.io.from\_frictionless\_schema(*schema*)[[source]](https://github.com/pandera-dev/pandera/blob/6da537f8741edb499fabf17f258b6a62d59bd2de/pandera/io.py#L695-L767)[#](#pandera.io.from_frictionless_schema "Permalink to this definition")

Create a [`DataFrameSchema`](index.html#pandera.schemas.DataFrameSchema "pandera.schemas.DataFrameSchema") from either a

frictionless json/yaml schema file saved on disk, or from a frictionless

schema already loaded into memory.

Each field from the frictionless schema will be converted to a pandera

column specification using [`FrictionlessFieldParser`](#pandera.io.FrictionlessFieldParser "pandera.io.FrictionlessFieldParser")

to map field characteristics to pandera column specifications.

Parameters

**schema** ([`Union`](https://docs.python.org/3/library/typing.html#typing.Union "(in Python v3.11)")[[`str`](https://docs.python.org/3/library/stdtypes.html#str "(in Python v3.11)"), [`Path`](https://docs.python.org/3/library/pathlib.html#pathlib.Path "(in Python v3.11)"), [`Dict`](https://docs.python.org/3/library/typing.html#typing.Dict "(in Python v3.11)"), `Schema`]) – the frictionless schema object (or a

string/Path to the location on disk of a schema specification) to

parse.

Return type

[`DataFrameSchema`](index.html#pandera.schemas.DataFrameSchema "pandera.schemas.DataFrameSchema")

Returns

dataframe schema with frictionless field specs converted to

pandera column checks and constraints for use as normal.

Example

Here, we’re defining a very basic frictionless schema in memory before

parsing it and then querying the resulting

[`DataFrameSchema`](index.html#pandera.schemas.DataFrameSchema "pandera.schemas.DataFrameSchema") object as per any other Pandera

schema:

```

>>> from pandera.io import from\_frictionless\_schema

>>>

>>> FRICTIONLESS\_SCHEMA = {

...     "fields": [

...         {

...             "name": "column\_1",

...             "type": "integer",

...             "constraints": {"minimum": 10, "maximum": 99}

...         },

...         {

...             "name": "column\_2",

...             "type": "string",

...             "constraints": {"maxLength": 10, "pattern": "\S+"}

...         },

...     ],

...     "primaryKey": "column\_1"

... }

>>> schema = from\_frictionless\_schema(FRICTIONLESS\_SCHEMA)

>>> schema.columns["column\_1"].checks

[<Check in\_range: in\_range(10, 99)>]

>>> schema.columns["column\_1"].required

True

>>> schema.columns["column\_1"].unique

True

>>> schema.columns["column\_2"].checks

[<Check str\_length: str\_length(None, 10)>, <Check str\_matches: str\_matches(re.compile('^\\S+$'))>]

```

under the hood, this uses the [`FrictionlessFieldParser`](#pandera.io.FrictionlessFieldParser "pandera.io.FrictionlessFieldParser") class

to parse each frictionless field (column):

*class* pandera.io.FrictionlessFieldParser(*field*, *primary\_keys*)[[source]](https://github.com/pandera-dev/pandera/blob/6da537f8741edb499fabf17f258b6a62d59bd2de/pandera/io.py#L528-L692)[#](#pandera.io.FrictionlessFieldParser "Permalink to this definition")

Parses frictionless data schema field specifications so we can convert

them to an equivalent Pandera [`Column`](index.html#pandera.schema_components.Column "pandera.schema_components.Column")

schema.

For this implementation, we are using field names, constraints and types

but leaving other frictionless parameters out (e.g. foreign keys, type

formats, titles, descriptions).

Parameters

* **field** – a field object from a frictionless schema.

* **primary\_keys** – the primary keys from a frictionless schema. These

are used to ensure primary key fields are treated properly - no

duplicates, no missing values etc.

*property* checks*: Optional[Dict]*[#](#pandera.io.FrictionlessFieldParser.checks "Permalink to this definition")

Convert a set of frictionless schema field constraints into checks.

This parses the standard set of frictionless constraints which can be

found

[here](https://specs.frictionlessdata.io/table-schema/#constraints)

and maps them into the equivalent pandera checks.

Return type

[`Optional`](https://docs.python.org/3/library/typing.html#typing.Optional "(in Python v3.11)")[[`Dict`](https://docs.python.org/3/library/typing.html#typing.Dict "(in Python v3.11)")]

Returns

a dictionary of pandera [`Check`](index.html#pandera.checks.Check "pandera.checks.Check")

objects which capture the standard constraint logic of a

frictionless schema field.

*property* coerce*: [bool](https://docs.python.org/3/library/functions.html#bool "(in Python v3.11)")*[#](#pandera.io.FrictionlessFieldParser.coerce "Permalink to this definition")

Determine whether values within this field should be coerced.

This currently returns `True` for all fields within a frictionless

schema.

Return type

[`bool`](https://docs.python.org/3/library/functions.html#bool "(in Python v3.11)")

*property* dtype*: [str](https://docs.python.org/3/library/stdtypes.html#str "(in Python v3.11)")*[#](#pandera.io.FrictionlessFieldParser.dtype "Permalink to this definition")

Determine what type of field this is, so we can feed that into

[`DataType`](index.html#pandera.dtypes.DataType "pandera.dtypes.DataType"). If no type is specified in the

frictionless schema, we default to string values.

Return type

[`str`](https://docs.python.org/3/library/stdtypes.html#str "(in Python v3.11)")

Returns

the pandas-compatible representation of this field type as a

string.

*property* nullable*: [bool](https://docs.python.org/3/library/functions.html#bool "(in Python v3.11)")*[#](#pandera.io.FrictionlessFieldParser.nullable "Permalink to this definition")

Determine whether this field can contain missing values.

If a field is a primary key, this will return `False`.

Return type

[`bool`](https://docs.python.org/3/library/functions.html#bool "(in Python v3.11)")

*property* regex*: [bool](https://docs.python.org/3/library/functions.html#bool "(in Python v3.11)")*[#](#pandera.io.FrictionlessFieldParser.regex "Permalink to this definition")

Determine whether this field name should be used for regex matches.

This currently returns `False` for all fields within a frictionless

schema.

Return type

[`bool`](https://docs.python.org/3/library/functions.html#bool "(in Python v3.11)")

*property* required*: [bool](https://docs.python.org/3/library/functions.html#bool "(in Python v3.11)")*[#](#pandera.io.FrictionlessFieldParser.required "Permalink to this definition")

Determine whether this field must exist within the data.

This currently returns `True` for all fields within a frictionless

schema.

Return type

[`bool`](https://docs.python.org/3/library/functions.html#bool "(in Python v3.11)")

to\_pandera\_column()[[source]](https://github.com/pandera-dev/pandera/blob/6da537f8741edb499fabf17f258b6a62d59bd2de/pandera/io.py#L681-L692)[#](#pandera.io.FrictionlessFieldParser.to_pandera_column "Permalink to this definition")

Export this field to a column spec dictionary.

Return type

[`Dict`](https://docs.python.org/3/library/typing.html#typing.Dict "(in Python v3.11)")

*property* unique*: [bool](https://docs.python.org/3/library/functions.html#bool "(in Python v3.11)")*[#](#pandera.io.FrictionlessFieldParser.unique "Permalink to this definition")

Determine whether this field can contain duplicate values.

If a field is a primary key, this will return `True`.

Return type

[`bool`](https://docs.python.org/3/library/functions.html#bool "(in Python v3.11)")

#### Mypy[#](#mypy "Permalink to this headline")

*new in 0.8.0*

Pandera integrates with mypy to provide static type-linting of dataframes,

relying on [pandas-stubs](https://github.com/VirtusLab/pandas-stubs)

for typing information.

```

pip install pandera[mypy]

```

Then enable the plugin in your `mypy.ini` or `setug.cfg` file:

```

[mypy]

plugins = pandera.mypy

```

Note

Mypy static type-linting is supported for only pandas dataframes.

Warning

This functionality is experimental 🧪. Since the

[pandas-stubs](https://github.com/VirtusLab/pandas-stubs) type stub

annotations don’t always match the official

[pandas effort to support type annotations](https://github.com/pandas-dev/pandas/issues/28142#issuecomment-991967009)),

installing the ``pandera[mypy]` extra may yield false positives in your

pandas code, many of which are are documented in `tests/mypy/modules`.

We encourage beta users to [file an issue](https://github.com/pandera-dev/pandera/issues/new?assignees=&labels=bug,mypy&template=bug_report.md&title=)

if they find any false positives or negatives being reported by `mypy`.

A list of such issues can be found [here](https://github.com/pandera-dev/pandera/labels/mypy).

In the example below, we define a few schemas to see how type-linting with

pandera works.

```

from typing import cast

import pandas as pd

import pandera as pa

from pandera.typing import DataFrame, Series

class Schema(pa.SchemaModel):

    id: Series[int]

    name: Series[str]

class SchemaOut(pa.SchemaModel):

    age: Series[int]

class AnotherSchema(pa.SchemaModel):

    id: Series[int]

    first\_name: Series[str]

```

The mypy linter will complain if the output type of the function body doesn’t

match the function’s return signature.

```

def fn(df: DataFrame[Schema]) -> DataFrame[SchemaOut]:

    return df.assign(age=30).pipe(DataFrame[SchemaOut])  # mypy okay

def fn\_pipe\_incorrect\_type(df: DataFrame[Schema]) -> DataFrame[SchemaOut]:

    return df.assign(age=30).pipe(DataFrame[AnotherSchema])  # mypy error

    # error: Argument 1 to "pipe" of "NDFrame" has incompatible type "Type[DataFrame[Any]]"; # noqa

    # expected "Union[Callable[..., DataFrame[SchemaOut]], Tuple[Callable[..., DataFrame[SchemaOut]], str]]" [arg-type] # noqa

def fn\_assign\_copy(df: DataFrame[Schema]) -> DataFrame[SchemaOut]:

    return df.assign(age=30)  # mypy error

    # error: Incompatible return value type (got "pandas.core.frame.DataFrame",

    # expected "pandera.typing.pandas.DataFrame[SchemaOut]") [return-value]

```

It’ll also complain if the input type doesn’t match the expected input type.

Note that we’re using the `pandera.typing.pandas.DataFrame` generic

type to define dataframes that are validated against the

[`SchemaModel`](index.html#pandera.model.SchemaModel "pandera.model.SchemaModel") type variable on initialization.

```

schema\_df = DataFrame[Schema]({"id": [1], "name": ["foo"]})

pandas\_df = pd.DataFrame({"id": [1], "name": ["foo"]})

another\_df = DataFrame[AnotherSchema]({"id": [1], "first\_name": ["foo"]})

fn(schema\_df)  # mypy okay

fn(pandas\_df)  # mypy error

# error: Argument 1 to "fn" has incompatible type "pandas.core.frame.DataFrame"; # noqa

# expected "pandera.typing.pandas.DataFrame[Schema]" [arg-type]

fn(another\_df)  # mypy error

# error: Argument 1 to "fn" has incompatible type "DataFrame[AnotherSchema]";

# expected "DataFrame[Schema]" [arg-type]

```

To make mypy happy with respect to the return type, you can either initialize

a dataframe of the expected type:

```

def fn\_pipe\_dataframe(df: DataFrame[Schema]) -> DataFrame[SchemaOut]:

    return df.assign(age=30).pipe(DataFrame[SchemaOut])  # mypy okay

```

Note

If you use the approach above with the `check\_types()`

decorator, pandera will do its best to not to validate the dataframe twice

if it’s already been initialized with the

`DataFrame[Schema](\*\*data)` syntax.

Or use [`typing.cast()`](https://docs.python.org/3/library/typing.html#typing.cast "(in Python v3.11)") to indicate to mypy that the return value of

the function is of the correct type.

```

def fn\_cast\_dataframe(df: DataFrame[Schema]) -> DataFrame[SchemaOut]:

    return cast(DataFrame[SchemaOut], df.assign(age=30))  # mypy okay

```

##### Limitations[#](#limitations "Permalink to this headline")

An important caveat to static type-linting with pandera dataframe types is that,

since pandas dataframes are mutable objects, there’s no way for `mypy` to

know whether a mutated instance of a

[`SchemaModel`](index.html#pandera.model.SchemaModel "pandera.model.SchemaModel")-typed dataframe has the correct

contents. Fortunately, we can simply rely on the `check\_types()`

decorator to verify that the output dataframe is valid.

Consider the examples below:

```

def fn\_pipe\_dataframe(df: DataFrame[Schema]) -> DataFrame[SchemaOut]:

    return df.assign(age=30).pipe(DataFrame[SchemaOut])  # mypy okay

def fn\_cast\_dataframe(df: DataFrame[Schema]) -> DataFrame[SchemaOut]:

    return cast(DataFrame[SchemaOut], df.assign(age=30))  # mypy okay

@pa.check\_types

def fn\_mutate\_inplace(df: DataFrame[Schema]) -> DataFrame[SchemaOut]:

    out = df.assign(age=30).pipe(DataFrame[SchemaOut])

    out.drop(["age"], axis=1, inplace=True)

    return out  # okay for mypy, pandera raises error

@pa.check\_types

def fn\_assign\_and\_get\_index(df: DataFrame[Schema]) -> DataFrame[SchemaOut]:

    return df.assign(foo=30).iloc[:3]  # okay for mypy, pandera raises error

```

Even though the outputs of these functions are incorrect, mypy doesn’t catch

the error during static type-linting but pandera will raise a

[`SchemaError`](index.html#pandera.errors.SchemaError "pandera.errors.SchemaError") or [`SchemaErrors`](index.html#pandera.errors.SchemaErrors "pandera.errors.SchemaErrors")

exception at runtime, depending on whether you’re doing

[lazy validation](index.html#lazy-validation) or not.

```

@pa.check\_types

def fn\_cast\_dataframe\_invalid(df: DataFrame[Schema]) -> DataFrame[SchemaOut]:

    return cast(

        DataFrame[SchemaOut], df

    )  # okay for mypy, pandera raises error

```

#### Pydantic[#](#pydantic "Permalink to this headline")

*new in 0.8.0*

##### Using Pandera Schemas in Pydantic Models[#](#using-pandera-schemas-in-pydantic-models "Permalink to this headline")

[`SchemaModel`](index.html#pandera.model.SchemaModel "pandera.model.SchemaModel") is fully compatible with

[pydantic](https://pydantic-docs.helpmanual.io/). You can specify

a [`SchemaModel`](index.html#pandera.model.SchemaModel "pandera.model.SchemaModel") in a pydantic `BaseModel` as you would

any other field:

```

import pandas as pd

import pandera as pa

from pandera.typing import DataFrame, Series

import pydantic

class SimpleSchema(pa.SchemaModel):

    str\_col: Series[str] = pa.Field(unique=True)

class PydanticModel(pydantic.BaseModel):

    x: int

    df: DataFrame[SimpleSchema]

valid\_df = pd.DataFrame({"str\_col": ["hello", "world"]})

PydanticModel(x=1, df=valid\_df)

invalid\_df = pd.DataFrame({"str\_col": ["hello", "hello"]})

PydanticModel(x=1, df=invalid\_df)

```

```

Traceback (most recent call last):

...

ValidationError: 1 validation error for PydanticModel

df

series 'str_col' contains duplicate values:

1    hello

Name: str_col, dtype: object (type=value_error)

```

Other pandera components are also compatible with pydantic:

Note

The `SeriesSchema`, `DataFrameSchema` and `schema\_components` types

validates the type of a schema object, e.g. if your pydantic

`BaseModel` contained a schema object, not a `pandas` object.

* [`SchemaModel`](index.html#pandera.model.SchemaModel "pandera.model.SchemaModel")

* [`DataFrameSchema`](index.html#pandera.schemas.DataFrameSchema "pandera.schemas.DataFrameSchema")

* [`SeriesSchema`](index.html#pandera.schemas.SeriesSchema "pandera.schemas.SeriesSchema")

* [`MultiIndex`](index.html#pandera.schema_components.MultiIndex "pandera.schema_components.MultiIndex")

* [`Column`](index.html#pandera.schema_components.Column "pandera.schema_components.Column")

* [`Index`](index.html#pandera.schema_components.Index "pandera.schema_components.Index")

##### Using Pydantic Models in Pandera Schemas[#](#using-pydantic-models-in-pandera-schemas "Permalink to this headline")

*new in 0.10.0*

You can also use a pydantic `BaseModel` in a pandera schema. Suppose you had

a `Record` model:

```

from pydantic import BaseModel

import pandera as pa

class Record(BaseModel):

    name: str

    xcoord: str

    ycoord: int

```

The `PydanticModel` datatype enables you to

specify the `Record` model as a row-wise type.

```

import pandas as pd

from pandera.engines.pandas\_engine import PydanticModel

class PydanticSchema(pa.SchemaModel):

    """Pandera schema using the pydantic model."""

    class Config:

        """Config with dataframe-level data type."""

        dtype = PydanticModel(Record)

        coerce = True  # this is required, otherwise a SchemaInitError is raised

```

Note

By combining `dtype=PydanticModel(...)` and `coerce=True`, pandera will

apply the pydantic model validation process to each row of the dataframe,

converting the model back to a dictionary with the BaseModel.dict() method.

The equivalent pandera schema would look like this:

```

class PanderaSchema(pa.SchemaModel):

    """Pandera schema that's equivalent to PydanticSchema."""

    name: pa.typing.Series[str]

    xcoord: pa.typing.Series[int]

    ycoord: pa.typing.Series[int]

```

Note

Since the `PydanticModel` datatype

applies the `BaseModel` constructor to each row of the dataframe, using

`PydanticModel` might not scale well with larger datasets.

**If you want to help benchmark**, consider

[contributing a benchmark script](https://github.com/pandera-dev/pandera/issues/794)

Note

Don’t see a library that you want supported? Check out the

[github issues](https://github.com/pandera-dev/pandera/issues) to see if

that library is in the roadmap. If it isn’t, open up a

[new issue](https://github.com/pandera-dev/pandera/issues/new?assignees=&labels=enhancement&template=feature_request.md&title=)

to add support for it!

### API[#](#api "Permalink to this headline")

| [Core](index.html#api-core) | The core objects for defining pandera schemas |

| [Data Types](index.html#api-dtypes) | Data types for type checking and coercion. |

| [Schema Models](index.html#api-schema-models) | Alternative class-based API for defining pandera schemas. |

| [Decorators](index.html#api-decorators) | Decorators for integrating pandera schemas with python functions. |

| [Schema Inference](index.html#api-schema-inference) | Bootstrap schemas from real data |

| [IO Utilities](index.html#api-io-utils) | Utility functions for reading/writing schemas |

| [Data Synthesis Strategies](index.html#api-strategies) | Module of functions for generating data from schemas. |

| [Extensions](index.html#api-extensions) | Utility functions for extending pandera functionality |

| [Errors](index.html#api-errors) | Pandera-specific exceptions |

#### Core[#](#core "Permalink to this headline")

##### Schemas[#](#schemas "Permalink to this headline")

| [`pandera.schemas.DataFrameSchema`](index.html#pandera.schemas.DataFrameSchema "pandera.schemas.DataFrameSchema") | A light-weight pandas DataFrame validator. |

| [`pandera.schemas.SeriesSchema`](index.html#pandera.schemas.SeriesSchema "pandera.schemas.SeriesSchema") | Series validator. |

##### Schema Components[#](#schema-components "Permalink to this headline")

| [`pandera.schema\_components.Column`](index.html#pandera.schema_components.Column "pandera.schema_components.Column") | Validate types and properties of DataFrame columns. |

| [`pandera.schema\_components.Index`](index.html#pandera.schema_components.Index "pandera.schema_components.Index") | Validate types and properties of a DataFrame Index. |

| [`pandera.schema\_components.MultiIndex`](index.html#pandera.schema_components.MultiIndex "pandera.schema_components.MultiIndex") | Validate types and properties of a DataFrame MultiIndex. |

##### Checks[#](#checks "Permalink to this headline")

| [`pandera.checks.Check`](index.html#pandera.checks.Check "pandera.checks.Check") | Check a pandas Series or DataFrame for certain properties. |

| [`pandera.hypotheses.Hypothesis`](index.html#pandera.hypotheses.Hypothesis "pandera.hypotheses.Hypothesis") | Special type of `Check` that defines hypothesis tests on data. |

#### Data Types[#](#data-types "Permalink to this headline")

##### Library-agnostic dtypes[#](#library-agnostic-dtypes "Permalink to this headline")

| [`pandera.dtypes.DataType`](index.html#pandera.dtypes.DataType "pandera.dtypes.DataType") | Base class of all Pandera data types. |

| [`pandera.dtypes.Bool`](index.html#pandera.dtypes.Bool "pandera.dtypes.Bool") | Semantic representation of a boolean data type. |

| [`pandera.dtypes.Timestamp`](index.html#pandera.dtypes.Timestamp "pandera.dtypes.Timestamp") | Semantic representation of a timestamp data type. |

| [`pandera.dtypes.DateTime`](index.html#pandera.dtypes.DateTime "pandera.dtypes.DateTime") | alias of [`pandera.dtypes.Timestamp`](index.html#pandera.dtypes.Timestamp "pandera.dtypes.Timestamp") |

| [`pandera.dtypes.Timedelta`](index.html#pandera.dtypes.Timedelta "pandera.dtypes.Timedelta") | Semantic representation of a delta time data type. |

| [`pandera.dtypes.Category`](index.html#pandera.dtypes.Category "pandera.dtypes.Category") | Semantic representation of a categorical data type. |

| [`pandera.dtypes.Float`](index.html#pandera.dtypes.Float "pandera.dtypes.Float") | Semantic representation of a floating data type. |

| [`pandera.dtypes.Float16`](index.html#pandera.dtypes.Float16 "pandera.dtypes.Float16") | Semantic representation of a floating data type stored in 16 bits. |

| [`pandera.dtypes.Float32`](index.html#pandera.dtypes.Float32 "pandera.dtypes.Float32") | Semantic representation of a floating data type stored in 32 bits. |

| [`pandera.dtypes.Float64`](index.html#pandera.dtypes.Float64 "pandera.dtypes.Float64") | Semantic representation of a floating data type stored in 64 bits. |

| [`pandera.dtypes.Float128`](index.html#pandera.dtypes.Float128 "pandera.dtypes.Float128") | Semantic representation of a floating data type stored in 128 bits. |

| [`pandera.dtypes.Int`](index.html#pandera.dtypes.Int "pandera.dtypes.Int") | Semantic representation of an integer data type. |

| [`pandera.dtypes.Int8`](index.html#pandera.dtypes.Int8 "pandera.dtypes.Int8") | Semantic representation of an integer data type stored in 8 bits. |

| [`pandera.dtypes.Int16`](index.html#pandera.dtypes.Int16 "pandera.dtypes.Int16") | Semantic representation of an integer data type stored in 16 bits. |

| [`pandera.dtypes.Int32`](index.html#pandera.dtypes.Int32 "pandera.dtypes.Int32") | Semantic representation of an integer data type stored in 32 bits. |

| [`pandera.dtypes.Int64`](index.html#pandera.dtypes.Int64 "pandera.dtypes.Int64") | Semantic representation of an integer data type stored in 64 bits. |

| [`pandera.dtypes.UInt`](index.html#pandera.dtypes.UInt "pandera.dtypes.UInt") | Semantic representation of an unsigned integer data type. |

| [`pandera.dtypes.UInt8`](index.html#pandera.dtypes.UInt8 "pandera.dtypes.UInt8") | Semantic representation of an unsigned integer data type stored in 8 bits. |

| [`pandera.dtypes.UInt16`](index.html#pandera.dtypes.UInt16 "pandera.dtypes.UInt16") | Semantic representation of an unsigned integer data type stored in 16 bits. |

| [`pandera.dtypes.UInt32`](index.html#pandera.dtypes.UInt32 "pandera.dtypes.UInt32") | Semantic representation of an unsigned integer data type stored in 32 bits. |

| [`pandera.dtypes.UInt64`](index.html#pandera.dtypes.UInt64 "pandera.dtypes.UInt64") | Semantic representation of an unsigned integer data type stored in 64 bits. |

| [`pandera.dtypes.Complex`](index.html#pandera.dtypes.Complex "pandera.dtypes.Complex") | Semantic representation of a complex number data type. |

| [`pandera.dtypes.Complex64`](index.html#pandera.dtypes.Complex64 "pandera.dtypes.Complex64") | Semantic representation of a complex number data type stored in 64 bits. |

| [`pandera.dtypes.Complex128`](index.html#pandera.dtypes.Complex128 "pandera.dtypes.Complex128") | Semantic representation of a complex number data type stored in 128 bits. |

| [`pandera.dtypes.Complex256`](index.html#pandera.dtypes.Complex256 "pandera.dtypes.Complex256") | Semantic representation of a complex number data type stored in 256 bits. |

| [`pandera.dtypes.Decimal`](index.html#pandera.dtypes.Decimal "pandera.dtypes.Decimal") | Semantic representation of a decimal data type. |

| [`pandera.dtypes.String`](index.html#pandera.dtypes.String "pandera.dtypes.String") | Semantic representation of a string data type. |

##### Pandas Dtypes[#](#pandas-dtypes "Permalink to this headline")

Listed here for compatibility with pandera versions < 0.7.

Passing native pandas dtypes to pandera components is preferred.

| [`pandera.engines.pandas\_engine.BOOL`](index.html#pandera.engines.pandas_engine.BOOL "pandera.engines.pandas_engine.BOOL") | Semantic representation of a [`pandas.BooleanDtype`](https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.BooleanDtype.html#pandas.BooleanDtype "(in pandas v1.5.1)"). |

| [`pandera.engines.pandas\_engine.INT8`](index.html#pandera.engines.pandas_engine.INT8 "pandera.engines.pandas_engine.INT8") | Semantic representation of a [`pandas.Int8Dtype`](https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.Int8Dtype.html#pandas.Int8Dtype "(in pandas v1.5.1)"). |

| [`pandera.engines.pandas\_engine.INT16`](index.html#pandera.engines.pandas_engine.INT16 "pandera.engines.pandas_engine.INT16") | Semantic representation of a [`pandas.Int16Dtype`](https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.Int16Dtype.html#pandas.Int16Dtype "(in pandas v1.5.1)"). |

| [`pandera.engines.pandas\_engine.INT32`](index.html#pandera.engines.pandas_engine.INT32 "pandera.engines.pandas_engine.INT32") | Semantic representation of a [`pandas.Int32Dtype`](https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.Int32Dtype.html#pandas.Int32Dtype "(in pandas v1.5.1)"). |

| [`pandera.engines.pandas\_engine.INT64`](index.html#pandera.engines.pandas_engine.INT64 "pandera.engines.pandas_engine.INT64") | Semantic representation of a [`pandas.Int64Dtype`](https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.Int64Dtype.html#pandas.Int64Dtype "(in pandas v1.5.1)"). |

| [`pandera.engines.pandas\_engine.UINT8`](index.html#pandera.engines.pandas_engine.UINT8 "pandera.engines.pandas_engine.UINT8") | Semantic representation of a [`pandas.UInt8Dtype`](https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.UInt8Dtype.html#pandas.UInt8Dtype "(in pandas v1.5.1)"). |

| [`pandera.engines.pandas\_engine.UINT16`](index.html#pandera.engines.pandas_engine.UINT16 "pandera.engines.pandas_engine.UINT16") | Semantic representation of a [`pandas.UInt16Dtype`](https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.UInt16Dtype.html#pandas.UInt16Dtype "(in pandas v1.5.1)"). |

| [`pandera.engines.pandas\_engine.UINT32`](index.html#pandera.engines.pandas_engine.UINT32 "pandera.engines.pandas_engine.UINT32") | Semantic representation of a [`pandas.UInt32Dtype`](https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.UInt32Dtype.html#pandas.UInt32Dtype "(in pandas v1.5.1)"). |

| [`pandera.engines.pandas\_engine.UINT64`](index.html#pandera.engines.pandas_engine.UINT64 "pandera.engines.pandas_engine.UINT64") | Semantic representation of a [`pandas.UInt64Dtype`](https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.UInt64Dtype.html#pandas.UInt64Dtype "(in pandas v1.5.1)"). |

| [`pandera.engines.pandas\_engine.STRING`](index.html#pandera.engines.pandas_engine.STRING "pandera.engines.pandas_engine.STRING") | Semantic representation of a [`pandas.StringDtype`](https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.StringDtype.html#pandas.StringDtype "(in pandas v1.5.1)"). |

| [`pandera.engines.numpy\_engine.Object`](index.html#pandera.engines.numpy_engine.Object "pandera.engines.numpy_engine.Object") | Semantic representation of a [`numpy.object\_`](https://numpy.org/doc/stable/reference/arrays.scalars.html#numpy.object_ "(in NumPy v1.23)"). |

| [`pandera.engines.pandas\_engine.DateTime`](index.html#pandera.engines.pandas_engine.DateTime "pandera.engines.pandas_engine.DateTime") | Semantic representation of a [`pandas.DatetimeTZDtype`](https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.DatetimeTZDtype.html#pandas.DatetimeTZDtype "(in pandas v1.5.1)"). |

| [`pandera.engines.pandas\_engine.Date`](index.html#pandera.engines.pandas_engine.Date "pandera.engines.pandas_engine.Date") | Semantic representation of a date data type. |

| [`pandera.engines.pandas\_engine.Decimal`](index.html#pandera.engines.pandas_engine.Decimal "pandera.engines.pandas_engine.Decimal") | Semantic representation of a [`decimal.Decimal`](https://docs.python.org/3/library/decimal.html#decimal.Decimal "(in Python v3.11)"). |

| [`pandera.engines.pandas\_engine.Category`](index.html#pandera.engines.pandas_engine.Category "pandera.engines.pandas_engine.Category") | Semantic representation of a [`pandas.CategoricalDtype`](https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.CategoricalDtype.html#pandas.CategoricalDtype "(in pandas v1.5.1)"). |

##### GeoPandas Dtypes[#](#geopandas-dtypes "Permalink to this headline")

*new in 0.9.0*

| [`pandera.engines.pandas\_engine.Geometry`](index.html#pandera.engines.pandas_engine.Geometry "pandera.engines.pandas_engine.Geometry") |  |

##### Pydantic Dtypes[#](#pydantic-dtypes "Permalink to this headline")

*new in 0.10.0*

| [`pandera.engines.pandas\_engine.PydanticModel`](index.html#pandera.engines.pandas_engine.PydanticModel "pandera.engines.pandas_engine.PydanticModel") | A pydantic model datatype applying to rows in a dataframe. |

##### Utility functions[#](#utility-functions "Permalink to this headline")

| [`pandera.dtypes.is\_subdtype`](index.html#pandera.dtypes.is_subdtype "pandera.dtypes.is_subdtype") | Returns True if first argument is lower/equal in DataType hierarchy. |

| [`pandera.dtypes.is\_float`](index.html#pandera.dtypes.is_float "pandera.dtypes.is_float") | Return True if [`pandera.dtypes.DataType`](index.html#pandera.dtypes.DataType "pandera.dtypes.DataType") is a float. |

| [`pandera.dtypes.is\_int`](index.html#pandera.dtypes.is_int "pandera.dtypes.is_int") | Return True if [`pandera.dtypes.DataType`](index.html#pandera.dtypes.DataType "pandera.dtypes.DataType") is an integer. |

| [`pandera.dtypes.is\_uint`](index.html#pandera.dtypes.is_uint "pandera.dtypes.is_uint") | Return True if [`pandera.dtypes.DataType`](index.html#pandera.dtypes.DataType "pandera.dtypes.DataType") is an unsigned integer. |

| [`pandera.dtypes.is\_complex`](index.html#pandera.dtypes.is_complex "pandera.dtypes.is_complex") | Return True if [`pandera.dtypes.DataType`](index.html#pandera.dtypes.DataType "pandera.dtypes.DataType") is a complex number. |

| [`pandera.dtypes.is\_numeric`](index.html#pandera.dtypes.is_numeric "pandera.dtypes.is_numeric") | Return True if [`pandera.dtypes.DataType`](index.html#pandera.dtypes.DataType "pandera.dtypes.DataType") is a complex number. |

| [`pandera.dtypes.is\_bool`](index.html#pandera.dtypes.is_bool "pandera.dtypes.is_bool") | Return True if [`pandera.dtypes.DataType`](index.html#pandera.dtypes.DataType "pandera.dtypes.DataType") is a boolean. |

| [`pandera.dtypes.is\_string`](index.html#pandera.dtypes.is_string "pandera.dtypes.is_string") | Return True if [`pandera.dtypes.DataType`](index.html#pandera.dtypes.DataType "pandera.dtypes.DataType") is a string. |

| [`pandera.dtypes.is\_datetime`](index.html#pandera.dtypes.is_datetime "pandera.dtypes.is_datetime") | Return True if [`pandera.dtypes.DataType`](index.html#pandera.dtypes.DataType "pandera.dtypes.DataType") is a datetime. |

| [`pandera.dtypes.is\_timedelta`](index.html#pandera.dtypes.is_timedelta "pandera.dtypes.is_timedelta") | Return True if [`pandera.dtypes.DataType`](index.html#pandera.dtypes.DataType "pandera.dtypes.DataType") is a timedelta. |

| [`pandera.dtypes.immutable`](index.html#pandera.dtypes.immutable "pandera.dtypes.immutable") | [`dataclasses.dataclass()`](https://docs.python.org/3/library/dataclasses.html#dataclasses.dataclass "(in Python v3.11)") decorator with different default values: frozen=True, init=False, repr=False. |

##### Engines[#](#engines "Permalink to this headline")

| [`pandera.engines.engine.Engine`](index.html#pandera.engines.engine.Engine "pandera.engines.engine.Engine") | Base Engine metaclass. |

| [`pandera.engines.numpy\_engine.Engine`](index.html#pandera.engines.numpy_engine.Engine "pandera.engines.numpy_engine.Engine") | Numpy data type engine. |

| [`pandera.engines.pandas\_engine.Engine`](index.html#pandera.engines.pandas_engine.Engine "pandera.engines.pandas_engine.Engine") | Pandas data type engine. |

#### Schema Models[#](#schema-models "Permalink to this headline")

##### Schema Model[#](#schema-model "Permalink to this headline")

| [`pandera.model.SchemaModel`](index.html#pandera.model.SchemaModel "pandera.model.SchemaModel")(\*args, \*\*kwargs) | Definition of a `DataFrameSchema`. |

##### Model Components[#](#model-components "Permalink to this headline")

| [`pandera.model\_components.Field`](index.html#pandera.model_components.Field "pandera.model_components.Field")(\*[, eq, ne, ...]) | Used to provide extra information about a field of a SchemaModel. |

| [`pandera.model\_components.check`](index.html#pandera.model_components.check "pandera.model_components.check")(\*fields[, regex]) | Decorator to make SchemaModel method a column/index check function. |

| [`pandera.model\_components.dataframe\_check`](index.html#pandera.model_components.dataframe_check "pandera.model_components.dataframe_check")([\_fn]) | Decorator to make SchemaModel method a dataframe-wide check function. |

##### Typing[#](#typing "Permalink to this headline")

| [`pandera.typing`](index.html#module-pandera.typing "pandera.typing") | Typing module. |

##### Config[#](#config "Permalink to this headline")

| [`pandera.model.BaseConfig`](index.html#pandera.model.BaseConfig "pandera.model.BaseConfig") | Define DataFrameSchema-wide options. |

#### Decorators[#](#decorators "Permalink to this headline")

| [`pandera.decorators.check\_input`](index.html#pandera.decorators.check_input "pandera.decorators.check_input") | Validate function argument when function is called. |

| [`pandera.decorators.check\_output`](index.html#pandera.decorators.check_output "pandera.decorators.check_output") | Validate function output. |

| [`pandera.decorators.check\_io`](index.html#pandera.decorators.check_io "pandera.decorators.check_io") | Check schema for multiple inputs and outputs. |

| [`pandera.decorators.check\_types`](index.html#pandera.decorators.check_types "pandera.decorators.check_types") | Validate function inputs and output based on type annotations. |

#### Schema Inference[#](#schema-inference "Permalink to this headline")

| [`pandera.schema\_inference.infer\_schema`](index.html#pandera.schema_inference.infer_schema "pandera.schema_inference.infer_schema") | Infer schema for pandas DataFrame or Series object. |

#### IO Utilities[#](#io-utilities "Permalink to this headline")

The `io` module and built-in `Hypothesis` checks require a pandera

installation with the corresponding extension, see the

[installation](index.html#installation) instructions for more details.

| [`pandera.io.from\_yaml`](index.html#pandera.io.from_yaml "pandera.io.from_yaml") | Create [`DataFrameSchema`](index.html#pandera.schemas.DataFrameSchema "pandera.schemas.DataFrameSchema") from yaml file. |

| [`pandera.io.to\_yaml`](index.html#pandera.io.to_yaml "pandera.io.to_yaml") | Write [`DataFrameSchema`](index.html#pandera.schemas.DataFrameSchema "pandera.schemas.DataFrameSchema") to yaml file. |

| [`pandera.io.to\_script`](index.html#pandera.io.to_script "pandera.io.to_script") | Write [`DataFrameSchema`](index.html#pandera.schemas.DataFrameSchema "pandera.schemas.DataFrameSchema") to a python script. |

#### Data Synthesis Strategies[#](#data-synthesis-strategies "Permalink to this headline")

| [`pandera.strategies`](index.html#module-pandera.strategies "pandera.strategies") | Generate synthetic data from a schema definition. |

#### Extensions[#](#extensions "Permalink to this headline")

| [`pandera.extensions`](index.html#module-pandera.extensions "pandera.extensions") | pandera API extensions |

#### Errors[#](#errors "Permalink to this headline")

| [`pandera.errors.SchemaError`](index.html#pandera.errors.SchemaError "pandera.errors.SchemaError") | Raised when object does not pass schema validation constraints. |

| [`pandera.errors.SchemaErrors`](index.html#pandera.errors.SchemaErrors "pandera.errors.SchemaErrors") | Raised when multiple schema are lazily collected into one error. |

| [`pandera.errors.SchemaInitError`](index.html#pandera.errors.SchemaInitError "pandera.errors.SchemaInitError") | Raised when schema initialization fails. |

| [`pandera.errors.SchemaDefinitionError`](index.html#pandera.errors.SchemaDefinitionError "pandera.errors.SchemaDefinitionError") | Raised when schema definition is invalid on object validation. |

### Contributing[#](#contributing "Permalink to this headline")

Whether you are a novice or experienced software developer, all contributions

and suggestions are welcome!

#### Getting Started[#](#getting-started "Permalink to this headline")

If you are looking to contribute to the *pandera* codebase, the best place to

start is the [GitHub “issues” tab](https://github.com/pandera-dev/pandera/issues).

This is also a great place for filing bug reports and making suggestions for

ways in which we can improve the code and documentation.

#### Contributing to the Codebase[#](#contributing-to-the-codebase "Permalink to this headline")

The code is hosted on [GitHub](https://github.com/pandera-dev/pandera/issues),

so you will need to use [Git](http://git-scm.com/) to clone the project and make

changes to the codebase.

First create your own fork of pandera, then clone it:

```

# replace <my-username> with your github username

git clone https://github.com/<my-username>/pandera.git

```

Once you’ve obtained a copy of the code, create a development environment that’s

separate from your existing Python environment so that you can make and test

changes without compromising your own work environment.

An excellent guide on setting up python environments can be found

[here](https://pandas.pydata.org/docs/development/contributing.html#creating-a-python-environment).

Pandera offers a `environment.yml` to set up a conda-based environment and

`requirements-dev.txt` for a virtualenv.

##### Environment Setup[#](#environment-setup "Permalink to this headline")

###### Option 1: `miniconda` Setup[#](#option-1-miniconda-setup "Permalink to this headline")

Install [miniconda](https://docs.conda.io/en/latest/miniconda.html), then run:

```

conda create -n pandera-dev python=3.8  # or any python version 3.7+

conda env update -n pandera-dev -f environment.yml

conda activate pandera-dev

pip install -e .

```

###### Option 2: `virtualenv` Setup[#](#option-2-virtualenv-setup "Permalink to this headline")

```

pip install virtualenv

virtualenv .venv/pandera-dev

source .venv/pandera-dev/bin/activate

pip install -r requirements-dev.txt

pip install -e .

```

###### Run Tests[#](#run-tests "Permalink to this headline")

```

pytest tests

```

###### Build Documentation Locally[#](#build-documentation-locally "Permalink to this headline")

```

make docs

```

###### Adding New Dependencies[#](#adding-new-dependencies "Permalink to this headline")

To add new dependencies to the project, make sure to alter the *environment.yml* file. Then to sync the dependencies from the *environment.yml* file to the *requirements-dev.txt* run the following command

```

python scripts/generate\_pip\_deps\_from\_conda.py

```

Moreover to add new dependecies in setup.py, it is necessary to add it to the **\_extras\_require** dictionary.

###### Set up `pre-commit`[#](#set-up-pre-commit "Permalink to this headline")

This project uses [pre-commit](https://pre-commit.com/) to ensure that code

standard checks pass locally before pushing to the remote project repo. Follow

the [installation instructions](https://pre-commit.com/#installation), then

set up hooks with `pre-commit install`. After, `black`, `pylint` and `mypy`

checks should be run with every commit.

Make sure everything is working correctly by running

```

pre-commit run --all

```

##### Making Changes[#](#making-changes "Permalink to this headline")

Before making changes to the codebase or documentation, create a new branch with:

```

git checkout -b <my-branch>

```

We recommend following the branch-naming convention described in [Making Pull Requests](#making-pull-requests).

##### Run the Full Test Suite Locally[#](#run-the-full-test-suite-locally "Permalink to this headline")

Before submitting your changes for review, make sure to check that your changes

do not break any tests by running:

```

# option 1: if you're working with conda (recommended)

$ make nox-conda

# option 2: if you're working with virtualenv

$ make nox

```

Option 2 assumes that you have python environments for all of the versions

that pandera supports.

###### Using `mamba` (optional)[#](#using-mamba-optional "Permalink to this headline")

You can also use [mamba](https://github.com/mamba-org/mamba), which is a faster

implementation of [miniconda](https://docs.conda.io/en/latest/miniconda.html),

to run the `nox` test suite. Simply install it via conda-forge, and

`make nox-conda` should use it under the hood.

```

$ conda install -c conda-forge mamba

$ make nox-conda

```

##### Project Releases[#](#project-releases "Permalink to this headline")

Releases are organized under [milestones](https://github.com/pandera-dev/pandera/milestones),

which are be associated with a corresponding branch. This project uses

[semantic versioning](https://semver.org/), and we recommend prioritizing issues

associated with the next release.

##### Contributing Documentation[#](#contributing-documentation "Permalink to this headline")

Maybe the easiest, fastest, and most useful way to contribute to this project

(and any other project) is to contribute documentation. If you find an API

within the project that doesn’t have an example or description, or could be

clearer in its explanation, contribute yours!

You can also find issues for improving documentation under the

[docs](https://github.com/pandera-dev/pandera/labels/docs) label. If you have

ideas for documentation improvements, you can create a new issue [here](https://github.com/pandera-dev/pandera/issues/new?assignees=&labels=docs&template=documentation-improvement.md&title=)

This project uses Sphinx for auto-documentation and RST syntax for docstrings.

Once you have the code downloaded and you find something that is in need of some

TLD, take a look at the [Sphinx](https://www.sphinx-doc.org/en/1.0/rest.html)

documentation or well-documented

[examples](https://pandera.readthedocs.io/en/stable/_modules/pandera/schemas.html#DataFrameSchema)

within the codebase for guidance on contributing.

You can build the html documentation by running `nox -s docs`. The built

documentation can be found in `docs/\_build`.

##### Contributing Bugfixes[#](#contributing-bugfixes "Permalink to this headline")

Bugs are reported under the [bug](https://github.com/pandera-dev/pandera/labels/bug)

label, so if you find a bug create a new issue [here](https://github.com/pandera-dev/pandera/issues/new?assignees=&labels=bug&template=bug_report.md&title=).

##### Contributing Enhancements[#](#contributing-enhancements "Permalink to this headline")

New feature issues can be found under the

[enhancements](https://github.com/pandera-dev/pandera/labels/enhancement) label.

You can request a feature by creating a new issue [here](https://github.com/pandera-dev/pandera/issues/new?assignees=&labels=enhancement&template=feature_request.md&title=).

##### Making Pull Requests[#](#making-pull-requests "Permalink to this headline")

Once your changes are ready to be submitted, make sure to push your changes to

your fork of the GitHub repo before creating a pull request. Depending on the

type of issue the pull request is resolving, your pull request should merge

onto the appropriate branch:

###### Bugfixes[#](#bugfixes "Permalink to this headline")

* branch naming convention: `bugfix/<issue number>` or `bugfix/<bugfix-name>`

* pull request to: `dev`

###### Documentation[#](#documentation "Permalink to this headline")

* branch naming convention: `docs/<issue number>` or `docs/<doc-name>`

* pull request to: `release/x.x.x` branch if specified in the issue milestone, otherwise `dev`

###### Enhancements[#](#enhancements "Permalink to this headline")

* branch naming convention: `feature/<issue number>` or `feature/<bugfix-name>`

* pull request to: `release/x.x.x` branch if specified in the issue milestone, otherwise `dev`

We will review your changes, and might ask you to make additional changes

before it is finally ready to merge. However, once it’s ready, we will merge

it, and you will have successfully contributed to the codebase!

##### Questions, Ideas, General Discussion[#](#questions-ideas-general-discussion "Permalink to this headline")

Head on over to the [discussion](https://github.com/pandera-dev/pandera/discussions)

section if you have questions or ideas, want to show off something that you

did with `pandera`, or want to discuss a topic related to the project.

##### Dataframe Schema Style Guides[#](#dataframe-schema-style-guides "Permalink to this headline")

We have guidelines regarding dataframe and schema styles that are encouraged

for each pull request:

* If specifying a single column DataFrame, this can be expressed as a one-liner:

```

DataFrameSchema({"col1": Column(...)})

```

* If specifying one column with multiple lines, or multiple columns:

```

DataFrameSchema(

    {

        "col1": Column(

            int,

            checks=[

                Check(...),

                Check(...),

            ]

        ),

    }

)

```

* If specifying columns with additional arguments that fit in one line:

```

DataFrameSchema(

    {"a": Column(int, nullable=True)},

    strict=True

)

```

* If specifying columns with additional arguments that don’t fit in one line:

```

DataFrameSchema(

    {

        "a": Column(

            int,

            nullable=True,

            coerce=True,

            ...

        ),

        "b": Column(

            ...,

        )

    },

    strict=True)

```

#### Deprecation policy[#](#deprecation-policy "Permalink to this headline")

This project adopts a rolling policy regarding the minimum supported version of its dependencies, based on [NEP 29](https://numpy.org/neps/nep-0029-deprecation_policy.html):

* **Python**: 42 months

* **NumPy**: 24 months

* **Pandas**: 18 months

This means the latest minor (X.Y) version from N months prior. Patch versions (x.y.Z) are not pinned, and only the latest available at the moment of publishing the xarray release is guaranteed to work.

How to Cite[#](#how-to-cite "Permalink to this headline")

---------------------------------------------------------

If you use `pandera` in the context of academic or industry research, please

consider citing the paper and/or software package.

### [Paper](https://conference.scipy.org/proceedings/scipy2020/niels_bantilan.html)[#](#id2 "Permalink to this headline")

```

@InProceedings{ niels_bantilan-proc-scipy-2020,

  author    = { {N}iels {B}antilan },

  title     = { pandera: {S}tatistical {D}ata {V}alidation of {P}andas {D}ataframes },

  booktitle = { {P}roceedings of the 19th {P}ython in {S}cience {C}onference },

  pages     = { 116 - 124 },

  year      = { 2020 },

  editor    = { {M}eghann {A}garwal and {C}hris {C}alloway and {D}illon {N}iederhut and {D}avid {S}hupe },

  doi       = { 10.25080/Majora-342d178e-010 }

}

```

### Software Package[#](#software-package "Permalink to this headline")

[![software package](https://zenodo.org/badge/DOI/10.5281/zenodo.3385265.svg)](https://doi.org/10.5281/zenodo.3385265)

  

License and Credits[#](#license-and-credits "Permalink to this headline")

-------------------------------------------------------------------------

`pandera` is licensed under the [MIT license](https://github.com/pandera-dev/pandera/blob/master/LICENSE.txt).

and is written and maintained by Niels Bantilan ([niels@pandera.ci](mailto:niels%40pandera.ci))

Indices and tables[#](#indices-and-tables "Permalink to this headline")

=======================================================================

* [Index](genindex.html)

 On this page

 

Introduction

* [A Statistical Data Testing Toolkit](index.html#document-index)

* [▶️ Try Pandera](index.html#document-try_pandera)

User Guide

* [DataFrame Schemas](index.html#document-dataframe_schemas)

	+ [Column Validation](index.html#column-validation)

		- [Null Values in Columns](index.html#null-values-in-columns)

		- [Coercing Types on Columns](index.html#coercing-types-on-columns)

		- [Required Columns](index.html#required-columns)

		- [Ordered Columns](index.html#ordered-columns)

		- [Stand-alone Column Validation](index.html#stand-alone-column-validation)

		- [Column Regex Pattern Matching](index.html#column-regex-pattern-matching)

		- [Handling Dataframe Columns not in the Schema](index.html#handling-dataframe-columns-not-in-the-schema)

		- [Validating the order of the columns](index.html#validating-the-order-of-the-columns)

		- [Validating the joint uniqueness of columns](index.html#validating-the-joint-uniqueness-of-columns)

	+ [Index Validation](index.html#index-validation)

	+ [MultiIndex Validation](index.html#multiindex-validation)

		- [MultiIndex Columns](index.html#multiindex-columns)

		- [MultiIndex Indexes](index.html#multiindex-indexes)

	+ [Get Pandas Data Types](index.html#get-pandas-data-types)

	+ [DataFrameSchema Transformations](index.html#dataframeschema-transformations)

* [Schema Models](index.html#document-schema_models)

	+ [Basic Usage](index.html#basic-usage)

	+ [Validate on Initialization](index.html#validate-on-initialization)

	+ [Converting to DataFrameSchema](index.html#converting-to-dataframeschema)

	+ [Excluded attributes](index.html#excluded-attributes)

	+ [Supported dtypes](index.html#supported-dtypes)

		- [Dtype aliases](index.html#dtype-aliases)

		- [Type Vs instance](index.html#type-vs-instance)

		- [Parametrized dtypes](index.html#parametrized-dtypes)

			* [Annotated](index.html#annotated)

			* [Field](index.html#field)

	+ [Required Columns](index.html#required-columns)

	+ [Schema Inheritance](index.html#schema-inheritance)

	+ [Config](index.html#config)

	+ [MultiIndex](index.html#multiindex)

	+ [Index Name](index.html#index-name)

	+ [Custom Checks](index.html#custom-checks)

		- [Column/Index checks](index.html#column-index-checks)

		- [DataFrame Checks](index.html#dataframe-checks)

		- [Inheritance](index.html#inheritance)

	+ [Aliases](index.html#aliases)

* [Series Schemas](index.html#document-series_schemas)

* [Checks](index.html#document-checks)

	+ [Checking column properties](index.html#checking-column-properties)

	+ [Built-in Checks](index.html#built-in-checks)

	+ [Vectorized vs. Element-wise Checks](index.html#vectorized-vs-element-wise-checks)

	+ [Handling Null Values](index.html#handling-null-values)

	+ [Column Check Groups](index.html#column-check-groups)

	+ [Wide Checks](index.html#wide-checks)

	+ [Raise UserWarning on Check Failure](index.html#raise-userwarning-on-check-failure)

	+ [Registering Custom Checks](index.html#registering-custom-checks)

* [Hypothesis Testing](index.html#document-hypothesis)

	+ [Overview](index.html#overview)

	+ [Wide Hypotheses](index.html#wide-hypotheses)

* [Pandera Data Types](index.html#document-dtypes)

	+ [Motivations](index.html#motivations)

	+ [DataType basics](index.html#datatype-basics)

	+ [Example](index.html#example)

	+ [Parametrized data types](index.html#parametrized-data-types)

	+ [Defining the `coerce\_value` method](index.html#defining-the-coerce-value-method)

	+ [Logical data types](index.html#logical-data-types)

* [Decorators for Pipeline Integration](index.html#document-decorators)

	+ [Check Input](index.html#check-input)

	+ [Check Output](index.html#check-output)

	+ [Check IO](index.html#check-io)

	+ [Decorate Functions and Coroutines](index.html#decorate-functions-and-coroutines)

* [Schema Inference](index.html#document-schema_inference)

	+ [Schema Persistence](index.html#schema-persistence)

		- [Write to a Python script](index.html#write-to-a-python-script)

		- [Write to YAML](index.html#write-to-yaml)

		- [Write to JSON](index.html#write-to-json)

* [Lazy Validation](index.html#document-lazy_validation)

* [Data Synthesis Strategies](index.html#document-data_synthesis_strategies)

	+ [Basic Usage](index.html#basic-usage)

	+ [Usage in Unit Tests](index.html#usage-in-unit-tests)

	+ [Strategies and Examples from Schema Models](index.html#strategies-and-examples-from-schema-models)

	+ [Checks as Constraints](index.html#checks-as-constraints)

		- [Check Strategy Chaining](index.html#check-strategy-chaining)

		- [In-line Custom Checks](index.html#in-line-custom-checks)

	+ [Defining Custom Strategies](index.html#defining-custom-strategies)

* [Extensions](index.html#document-extensions)

	+ [Registering Custom Check Methods](index.html#registering-custom-check-methods)

	+ [Specifying a Check Strategy](index.html#specifying-a-check-strategy)

	+ [Check Types](index.html#check-types)

		- [Element-wise Checks](index.html#element-wise-checks)

		- [Groupby Checks](index.html#groupby-checks)

	+ [Registered Custom Checks with the Class-based API](index.html#registered-custom-checks-with-the-class-based-api)

* [Data Format Conversion](index.html#document-data_format_conversion)

	+ [The `to/from\_format` Configuration Options](index.html#the-to-from-format-configuration-options)

	+ [Takeaway](index.html#takeaway)

* [Supported DataFrame Libraries](index.html#document-supported_libraries)

	+ [Domain-specific Data Validation](index.html#domain-specific-data-validation)

		- [GeoPandas](index.html#document-geopandas)

	+ [Scaling Up Data Validation](index.html#scaling-up-data-validation)

		- [Dask](index.html#document-dask)

		- [Fugue](index.html#document-fugue)

			* [What is Fugue?](index.html#what-is-fugue)

			* [Example](index.html#example)

			* [Validation by Partition](index.html#validation-by-partition)

			* [Returning Errors](index.html#returning-errors)

		- [Koalas](index.html#document-koalas)

		- [Pyspark ⭐️ (New)](index.html#document-pyspark)

		- [Modin](index.html#document-modin)

* [Integrations](index.html#document-integrations)

	+ [FastAPI](index.html#document-fastapi)

		- [Using SchemaModels to Validate Endpoint Inputs and Outputs](index.html#using-schemamodels-to-validate-endpoint-inputs-and-outputs)

		- [Reading File Uploads](index.html#reading-file-uploads)

		- [Takeaway](index.html#takeaway)

	+ [Frictionless](index.html#document-frictionless)

		- [Frictionless Data Schema](index.html#frictionless-data-schema)

	+ [Hypothesis](index.html#document-data_synthesis_strategies)

		- [Basic Usage](index.html#basic-usage)

		- [Usage in Unit Tests](index.html#usage-in-unit-tests)

		- [Strategies and Examples from Schema Models](index.html#strategies-and-examples-from-schema-models)

		- [Checks as Constraints](index.html#checks-as-constraints)

			* [Check Strategy Chaining](index.html#check-strategy-chaining)

			* [In-line Custom Checks](index.html#in-line-custom-checks)

		- [Defining Custom Strategies](index.html#defining-custom-strategies)

	+ [Mypy](index.html#document-mypy_integration)

		- [Limitations](index.html#limitations)

	+ [Pydantic](index.html#document-pydantic_integration)

		- [Using Pandera Schemas in Pydantic Models](index.html#using-pandera-schemas-in-pydantic-models)

		- [Using Pydantic Models in Pandera Schemas](index.html#using-pydantic-models-in-pandera-schemas)

Reference

* [API](index.html#document-reference/index)

	+ [Core](index.html#document-reference/core)

		- [Schemas](index.html#schemas)

			* [pandera.schemas.DataFrameSchema](index.html#document-reference/generated/pandera.schemas.DataFrameSchema)

				+ [pandera.schemas.DataFrameSchema.\_\_init\_\_](index.html#document-reference/generated/methods/pandera.schemas.DataFrameSchema.__init__)

				+ [pandera.schemas.DataFrameSchema.add\_columns](index.html#document-reference/generated/methods/pandera.schemas.DataFrameSchema.add_columns)

				+ [pandera.schemas.DataFrameSchema.coerce\_dtype](index.html#document-reference/generated/methods/pandera.schemas.DataFrameSchema.coerce_dtype)

				+ [pandera.schemas.DataFrameSchema.example](index.html#document-reference/generated/methods/pandera.schemas.DataFrameSchema.example)

				+ [pandera.schemas.DataFrameSchema.from\_json](index.html#document-reference/generated/methods/pandera.schemas.DataFrameSchema.from_json)

				+ [pandera.schemas.DataFrameSchema.from\_yaml](index.html#document-reference/generated/methods/pandera.schemas.DataFrameSchema.from_yaml)

				+ [pandera.schemas.DataFrameSchema.get\_dtypes](index.html#document-reference/generated/methods/pandera.schemas.DataFrameSchema.get_dtypes)

				+ [pandera.schemas.DataFrameSchema.remove\_columns](index.html#document-reference/generated/methods/pandera.schemas.DataFrameSchema.remove_columns)

				+ [pandera.schemas.DataFrameSchema.rename\_columns](index.html#document-reference/generated/methods/pandera.schemas.DataFrameSchema.rename_columns)

				+ [pandera.schemas.DataFrameSchema.reset\_index](index.html#document-reference/generated/methods/pandera.schemas.DataFrameSchema.reset_index)

				+ [pandera.schemas.DataFrameSchema.select\_columns](index.html#document-reference/generated/methods/pandera.schemas.DataFrameSchema.select_columns)

				+ [pandera.schemas.DataFrameSchema.set\_index](index.html#document-reference/generated/methods/pandera.schemas.DataFrameSchema.set_index)

				+ [pandera.schemas.DataFrameSchema.strategy](index.html#document-reference/generated/methods/pandera.schemas.DataFrameSchema.strategy)

				+ [pandera.schemas.DataFrameSchema.to\_json](index.html#document-reference/generated/methods/pandera.schemas.DataFrameSchema.to_json)

				+ [pandera.schemas.DataFrameSchema.to\_script](index.html#document-reference/generated/methods/pandera.schemas.DataFrameSchema.to_script)

				+ [pandera.schemas.DataFrameSchema.to\_yaml](index.html#document-reference/generated/methods/pandera.schemas.DataFrameSchema.to_yaml)

				+ [pandera.schemas.DataFrameSchema.update\_column](index.html#document-reference/generated/methods/pandera.schemas.DataFrameSchema.update_column)

				+ [pandera.schemas.DataFrameSchema.update\_columns](index.html#document-reference/generated/methods/pandera.schemas.DataFrameSchema.update_columns)

				+ [pandera.schemas.DataFrameSchema.validate](index.html#document-reference/generated/methods/pandera.schemas.DataFrameSchema.validate)

				+ [pandera.schemas.DataFrameSchema.\_\_call\_\_](index.html#document-reference/generated/methods/pandera.schemas.DataFrameSchema.__call__)

			* [pandera.schemas.SeriesSchema](index.html#document-reference/generated/pandera.schemas.SeriesSchema)

				+ [pandera.schemas.SeriesSchema.\_\_init\_\_](index.html#document-reference/generated/methods/pandera.schemas.SeriesSchema.__init__)

				+ [pandera.schemas.SeriesSchema.validate](index.html#document-reference/generated/methods/pandera.schemas.SeriesSchema.validate)

				+ [pandera.schemas.SeriesSchema.\_\_call\_\_](index.html#document-reference/generated/methods/pandera.schemas.SeriesSchema.__call__)

		- [Schema Components](index.html#schema-components)

			* [pandera.schema\_components.Column](index.html#document-reference/generated/pandera.schema_components.Column)

				+ [pandera.schema\_components.Column.\_\_init\_\_](index.html#document-reference/generated/methods/pandera.schema_components.Column.__init__)

				+ [pandera.schema\_components.Column.coerce\_dtype](index.html#document-reference/generated/methods/pandera.schema_components.Column.coerce_dtype)

				+ [pandera.schema\_components.Column.example](index.html#document-reference/generated/methods/pandera.schema_components.Column.example)

				+ [pandera.schema\_components.Column.get\_regex\_columns](index.html#document-reference/generated/methods/pandera.schema_components.Column.get_regex_columns)

				+ [pandera.schema\_components.Column.set\_name](index.html#document-reference/generated/methods/pandera.schema_components.Column.set_name)

				+ [pandera.schema\_components.Column.strategy](index.html#document-reference/generated/methods/pandera.schema_components.Column.strategy)

				+ [pandera.schema\_components.Column.strategy\_component](index.html#document-reference/generated/methods/pandera.schema_components.Column.strategy_component)

				+ [pandera.schema\_components.Column.validate](index.html#document-reference/generated/methods/pandera.schema_components.Column.validate)

				+ [pandera.schema\_components.Column.\_\_call\_\_](index.html#document-reference/generated/methods/pandera.schema_components.Column.__call__)

			* [pandera.schema\_components.Index](index.html#document-reference/generated/pandera.schema_components.Index)

				+ [pandera.schema\_components.Index.example](index.html#document-reference/generated/methods/pandera.schema_components.Index.example)

				+ [pandera.schema\_components.Index.strategy](index.html#document-reference/generated/methods/pandera.schema_components.Index.strategy)

				+ [pandera.schema\_components.Index.strategy\_component](index.html#document-reference/generated/methods/pandera.schema_components.Index.strategy_component)

				+ [pandera.schema\_components.Index.validate](index.html#document-reference/generated/methods/pandera.schema_components.Index.validate)

				+ [pandera.schema\_components.Index.\_\_call\_\_](index.html#document-reference/generated/methods/pandera.schema_components.Index.__call__)

			* [pandera.schema\_components.MultiIndex](index.html#document-reference/generated/pandera.schema_components.MultiIndex)

				+ [pandera.schema\_components.MultiIndex.\_\_init\_\_](index.html#document-reference/generated/methods/pandera.schema_components.MultiIndex.__init__)

				+ [pandera.schema\_components.MultiIndex.coerce\_dtype](index.html#document-reference/generated/methods/pandera.schema_components.MultiIndex.coerce_dtype)

				+ [pandera.schema\_components.MultiIndex.example](index.html#document-reference/generated/methods/pandera.schema_components.MultiIndex.example)

				+ [pandera.schema\_components.MultiIndex.strategy](index.html#document-reference/generated/methods/pandera.schema_components.MultiIndex.strategy)

				+ [pandera.schema\_components.MultiIndex.validate](index.html#document-reference/generated/methods/pandera.schema_components.MultiIndex.validate)

				+ [pandera.schema\_components.MultiIndex.\_\_call\_\_](index.html#document-reference/generated/methods/pandera.schema_components.MultiIndex.__call__)

		- [Checks](index.html#checks)

			* [pandera.checks.Check](index.html#document-reference/generated/pandera.checks.Check)

				+ [pandera.checks.Check.eq](index.html#document-reference/generated/methods/pandera.checks.Check.eq)

				+ [pandera.checks.Check.equal\_to](index.html#document-reference/generated/methods/pandera.checks.Check.equal_to)

				+ [pandera.checks.Check.ge](index.html#document-reference/generated/methods/pandera.checks.Check.ge)

				+ [pandera.checks.Check.greater\_than](index.html#document-reference/generated/methods/pandera.checks.Check.greater_than)

				+ [pandera.checks.Check.greater\_than\_or\_equal\_to](index.html#document-reference/generated/methods/pandera.checks.Check.greater_than_or_equal_to)

				+ [pandera.checks.Check.gt](index.html#document-reference/generated/methods/pandera.checks.Check.gt)

				+ [pandera.checks.Check.in\_range](index.html#document-reference/generated/methods/pandera.checks.Check.in_range)

				+ [pandera.checks.Check.isin](index.html#document-reference/generated/methods/pandera.checks.Check.isin)

				+ [pandera.checks.Check.le](index.html#document-reference/generated/methods/pandera.checks.Check.le)

				+ [pandera.checks.Check.less\_than](index.html#document-reference/generated/methods/pandera.checks.Check.less_than)

				+ [pandera.checks.Check.less\_than\_or\_equal\_to](index.html#document-reference/generated/methods/pandera.checks.Check.less_than_or_equal_to)

				+ [pandera.checks.Check.lt](index.html#document-reference/generated/methods/pandera.checks.Check.lt)

				+ [pandera.checks.Check.ne](index.html#document-reference/generated/methods/pandera.checks.Check.ne)

				+ [pandera.checks.Check.not\_equal\_to](index.html#document-reference/generated/methods/pandera.checks.Check.not_equal_to)

				+ [pandera.checks.Check.notin](index.html#document-reference/generated/methods/pandera.checks.Check.notin)

				+ [pandera.checks.Check.str\_contains](index.html#document-reference/generated/methods/pandera.checks.Check.str_contains)

				+ [pandera.checks.Check.str\_endswith](index.html#document-reference/generated/methods/pandera.checks.Check.str_endswith)

				+ [pandera.checks.Check.str\_length](index.html#document-reference/generated/methods/pandera.checks.Check.str_length)

				+ [pandera.checks.Check.str\_matches](index.html#document-reference/generated/methods/pandera.checks.Check.str_matches)

				+ [pandera.checks.Check.str\_startswith](index.html#document-reference/generated/methods/pandera.checks.Check.str_startswith)

				+ [pandera.checks.Check.unique\_values\_eq](index.html#document-reference/generated/methods/pandera.checks.Check.unique_values_eq)

				+ [pandera.checks.Check.\_\_call\_\_](index.html#document-reference/generated/methods/pandera.checks.Check.__call__)

			* [pandera.hypotheses.Hypothesis](index.html#document-reference/generated/pandera.hypotheses.Hypothesis)

				+ [pandera.hypotheses.Hypothesis.\_\_init\_\_](index.html#document-reference/generated/methods/pandera.hypotheses.Hypothesis.__init__)

				+ [pandera.hypotheses.Hypothesis.one\_sample\_ttest](index.html#document-reference/generated/methods/pandera.hypotheses.Hypothesis.one_sample_ttest)

				+ [pandera.hypotheses.Hypothesis.two\_sample\_ttest](index.html#document-reference/generated/methods/pandera.hypotheses.Hypothesis.two_sample_ttest)

				+ [pandera.hypotheses.Hypothesis.\_\_call\_\_](index.html#document-reference/generated/methods/pandera.hypotheses.Hypothesis.__call__)

	+ [Data Types](index.html#document-reference/dtypes)

		- [Library-agnostic dtypes](index.html#library-agnostic-dtypes)

			* [pandera.dtypes.DataType](index.html#document-reference/generated/pandera.dtypes.DataType)

				+ [pandera.dtypes.DataType.\_\_init\_\_](index.html#document-reference/generated/methods/pandera.dtypes.DataType.__init__)

				+ [pandera.dtypes.DataType.check](index.html#document-reference/generated/methods/pandera.dtypes.DataType.check)

				+ [pandera.dtypes.DataType.coerce](index.html#document-reference/generated/methods/pandera.dtypes.DataType.coerce)

				+ [pandera.dtypes.DataType.coerce\_value](index.html#document-reference/generated/methods/pandera.dtypes.DataType.coerce_value)

				+ [pandera.dtypes.DataType.try\_coerce](index.html#document-reference/generated/methods/pandera.dtypes.DataType.try_coerce)

				+ [pandera.dtypes.DataType.\_\_call\_\_](index.html#document-reference/generated/methods/pandera.dtypes.DataType.__call__)

			* [pandera.dtypes.Bool](index.html#document-reference/generated/pandera.dtypes.Bool)

				+ [pandera.dtypes.Bool.\_\_init\_\_](index.html#document-reference/generated/methods/pandera.dtypes.Bool.__init__)

				+ [pandera.dtypes.Bool.check](index.html#document-reference/generated/methods/pandera.dtypes.Bool.check)

				+ [pandera.dtypes.Bool.coerce](index.html#document-reference/generated/methods/pandera.dtypes.Bool.coerce)

				+ [pandera.dtypes.Bool.coerce\_value](index.html#document-reference/generated/methods/pandera.dtypes.Bool.coerce_value)

				+ [pandera.dtypes.Bool.try\_coerce](index.html#document-reference/generated/methods/pandera.dtypes.Bool.try_coerce)

				+ [pandera.dtypes.Bool.\_\_call\_\_](index.html#document-reference/generated/methods/pandera.dtypes.Bool.__call__)

			* [pandera.dtypes.Timestamp](index.html#document-reference/generated/pandera.dtypes.Timestamp)

				+ [pandera.dtypes.Timestamp.\_\_init\_\_](index.html#document-reference/generated/methods/pandera.dtypes.Timestamp.__init__)

				+ [pandera.dtypes.Timestamp.check](index.html#document-reference/generated/methods/pandera.dtypes.Timestamp.check)

				+ [pandera.dtypes.Timestamp.coerce](index.html#document-reference/generated/methods/pandera.dtypes.Timestamp.coerce)

				+ [pandera.dtypes.Timestamp.coerce\_value](index.html#document-reference/generated/methods/pandera.dtypes.Timestamp.coerce_value)

				+ [pandera.dtypes.Timestamp.try\_coerce](index.html#document-reference/generated/methods/pandera.dtypes.Timestamp.try_coerce)

				+ [pandera.dtypes.Timestamp.\_\_call\_\_](index.html#document-reference/generated/methods/pandera.dtypes.Timestamp.__call__)

			* [pandera.dtypes.DateTime](index.html#document-reference/generated/pandera.dtypes.DateTime)

			* [pandera.dtypes.Timedelta](index.html#document-reference/generated/pandera.dtypes.Timedelta)

				+ [pandera.dtypes.Timedelta.\_\_init\_\_](index.html#document-reference/generated/methods/pandera.dtypes.Timedelta.__init__)

				+ [pandera.dtypes.Timedelta.check](index.html#document-reference/generated/methods/pandera.dtypes.Timedelta.check)

				+ [pandera.dtypes.Timedelta.coerce](index.html#document-reference/generated/methods/pandera.dtypes.Timedelta.coerce)

				+ [pandera.dtypes.Timedelta.coerce\_value](index.html#document-reference/generated/methods/pandera.dtypes.Timedelta.coerce_value)

				+ [pandera.dtypes.Timedelta.try\_coerce](index.html#document-reference/generated/methods/pandera.dtypes.Timedelta.try_coerce)

				+ [pandera.dtypes.Timedelta.\_\_call\_\_](index.html#document-reference/generated/methods/pandera.dtypes.Timedelta.__call__)

			* [pandera.dtypes.Category](index.html#document-reference/generated/pandera.dtypes.Category)

				+ [pandera.dtypes.Category.\_\_init\_\_](index.html#document-reference/generated/methods/pandera.dtypes.Category.__init__)

				+ [pandera.dtypes.Category.check](index.html#document-reference/generated/methods/pandera.dtypes.Category.check)

				+ [pandera.dtypes.Category.coerce](index.html#document-reference/generated/methods/pandera.dtypes.Category.coerce)

				+ [pandera.dtypes.Category.coerce\_value](index.html#document-reference/generated/methods/pandera.dtypes.Category.coerce_value)

				+ [pandera.dtypes.Category.try\_coerce](index.html#document-reference/generated/methods/pandera.dtypes.Category.try_coerce)

				+ [pandera.dtypes.Category.\_\_call\_\_](index.html#document-reference/generated/methods/pandera.dtypes.Category.__call__)

			* [pandera.dtypes.Float](index.html#document-reference/generated/pandera.dtypes.Float)

				+ [pandera.dtypes.Float.\_\_init\_\_](index.html#document-reference/generated/methods/pandera.dtypes.Float.__init__)

				+ [pandera.dtypes.Float.check](index.html#document-reference/generated/methods/pandera.dtypes.Float.check)

				+ [pandera.dtypes.Float.coerce](index.html#document-reference/generated/methods/pandera.dtypes.Float.coerce)

				+ [pandera.dtypes.Float.coerce\_value](index.html#document-reference/generated/methods/pandera.dtypes.Float.coerce_value)

				+ [pandera.dtypes.Float.try\_coerce](index.html#document-reference/generated/methods/pandera.dtypes.Float.try_coerce)

				+ [pandera.dtypes.Float.\_\_call\_\_](index.html#document-reference/generated/methods/pandera.dtypes.Float.__call__)

			* [pandera.dtypes.Float16](index.html#document-reference/generated/pandera.dtypes.Float16)

				+ [pandera.dtypes.Float16.\_\_init\_\_](index.html#document-reference/generated/methods/pandera.dtypes.Float16.__init__)

				+ [pandera.dtypes.Float16.check](index.html#document-reference/generated/methods/pandera.dtypes.Float16.check)

				+ [pandera.dtypes.Float16.coerce](index.html#document-reference/generated/methods/pandera.dtypes.Float16.coerce)

				+ [pandera.dtypes.Float16.coerce\_value](index.html#document-reference/generated/methods/pandera.dtypes.Float16.coerce_value)

				+ [pandera.dtypes.Float16.try\_coerce](index.html#document-reference/generated/methods/pandera.dtypes.Float16.try_coerce)

				+ [pandera.dtypes.Float16.\_\_call\_\_](index.html#document-reference/generated/methods/pandera.dtypes.Float16.__call__)

			* [pandera.dtypes.Float32](index.html#document-reference/generated/pandera.dtypes.Float32)

				+ [pandera.dtypes.Float32.\_\_init\_\_](index.html#document-reference/generated/methods/pandera.dtypes.Float32.__init__)

				+ [pandera.dtypes.Float32.check](index.html#document-reference/generated/methods/pandera.dtypes.Float32.check)

				+ [pandera.dtypes.Float32.coerce](index.html#document-reference/generated/methods/pandera.dtypes.Float32.coerce)

				+ [pandera.dtypes.Float32.coerce\_value](index.html#document-reference/generated/methods/pandera.dtypes.Float32.coerce_value)

				+ [pandera.dtypes.Float32.try\_coerce](index.html#document-reference/generated/methods/pandera.dtypes.Float32.try_coerce)

				+ [pandera.dtypes.Float32.\_\_call\_\_](index.html#document-reference/generated/methods/pandera.dtypes.Float32.__call__)

			* [pandera.dtypes.Float64](index.html#document-reference/generated/pandera.dtypes.Float64)

				+ [pandera.dtypes.Float64.\_\_init\_\_](index.html#document-reference/generated/methods/pandera.dtypes.Float64.__init__)

				+ [pandera.dtypes.Float64.check](index.html#document-reference/generated/methods/pandera.dtypes.Float64.check)

				+ [pandera.dtypes.Float64.coerce](index.html#document-reference/generated/methods/pandera.dtypes.Float64.coerce)

				+ [pandera.dtypes.Float64.coerce\_value](index.html#document-reference/generated/methods/pandera.dtypes.Float64.coerce_value)

				+ [pandera.dtypes.Float64.try\_coerce](index.html#document-reference/generated/methods/pandera.dtypes.Float64.try_coerce)

				+ [pandera.dtypes.Float64.\_\_call\_\_](index.html#document-reference/generated/methods/pandera.dtypes.Float64.__call__)

			* [pandera.dtypes.Float128](index.html#document-reference/generated/pandera.dtypes.Float128)

				+ [pandera.dtypes.Float128.\_\_init\_\_](index.html#document-reference/generated/methods/pandera.dtypes.Float128.__init__)

				+ [pandera.dtypes.Float128.check](index.html#document-reference/generated/methods/pandera.dtypes.Float128.check)

				+ [pandera.dtypes.Float128.coerce](index.html#document-reference/generated/methods/pandera.dtypes.Float128.coerce)

				+ [pandera.dtypes.Float128.coerce\_value](index.html#document-reference/generated/methods/pandera.dtypes.Float128.coerce_value)

				+ [pandera.dtypes.Float128.try\_coerce](index.html#document-reference/generated/methods/pandera.dtypes.Float128.try_coerce)

				+ [pandera.dtypes.Float128.\_\_call\_\_](index.html#document-reference/generated/methods/pandera.dtypes.Float128.__call__)

			* [pandera.dtypes.Int](index.html#document-reference/generated/pandera.dtypes.Int)

				+ [pandera.dtypes.Int.\_\_init\_\_](index.html#document-reference/generated/methods/pandera.dtypes.Int.__init__)

				+ [pandera.dtypes.Int.check](index.html#document-reference/generated/methods/pandera.dtypes.Int.check)

				+ [pandera.dtypes.Int.coerce](index.html#document-reference/generated/methods/pandera.dtypes.Int.coerce)

				+ [pandera.dtypes.Int.coerce\_value](index.html#document-reference/generated/methods/pandera.dtypes.Int.coerce_value)

				+ [pandera.dtypes.Int.try\_coerce](index.html#document-reference/generated/methods/pandera.dtypes.Int.try_coerce)

				+ [pandera.dtypes.Int.\_\_call\_\_](index.html#document-reference/generated/methods/pandera.dtypes.Int.__call__)

			* [pandera.dtypes.Int8](index.html#document-reference/generated/pandera.dtypes.Int8)

				+ [pandera.dtypes.Int8.\_\_init\_\_](index.html#document-reference/generated/methods/pandera.dtypes.Int8.__init__)

				+ [pandera.dtypes.Int8.check](index.html#document-reference/generated/methods/pandera.dtypes.Int8.check)

				+ [pandera.dtypes.Int8.coerce](index.html#document-reference/generated/methods/pandera.dtypes.Int8.coerce)

				+ [pandera.dtypes.Int8.coerce\_value](index.html#document-reference/generated/methods/pandera.dtypes.Int8.coerce_value)

				+ [pandera.dtypes.Int8.try\_coerce](index.html#document-reference/generated/methods/pandera.dtypes.Int8.try_coerce)

				+ [pandera.dtypes.Int8.\_\_call\_\_](index.html#document-reference/generated/methods/pandera.dtypes.Int8.__call__)

			* [pandera.dtypes.Int16](index.html#document-reference/generated/pandera.dtypes.Int16)

				+ [pandera.dtypes.Int16.\_\_init\_\_](index.html#document-reference/generated/methods/pandera.dtypes.Int16.__init__)

				+ [pandera.dtypes.Int16.check](index.html#document-reference/generated/methods/pandera.dtypes.Int16.check)

				+ [pandera.dtypes.Int16.coerce](index.html#document-reference/generated/methods/pandera.dtypes.Int16.coerce)

				+ [pandera.dtypes.Int16.coerce\_value](index.html#document-reference/generated/methods/pandera.dtypes.Int16.coerce_value)

				+ [pandera.dtypes.Int16.try\_coerce](index.html#document-reference/generated/methods/pandera.dtypes.Int16.try_coerce)

				+ [pandera.dtypes.Int16.\_\_call\_\_](index.html#document-reference/generated/methods/pandera.dtypes.Int16.__call__)

			* [pandera.dtypes.Int32](index.html#document-reference/generated/pandera.dtypes.Int32)

				+ [pandera.dtypes.Int32.\_\_init\_\_](index.html#document-reference/generated/methods/pandera.dtypes.Int32.__init__)

				+ [pandera.dtypes.Int32.check](index.html#document-reference/generated/methods/pandera.dtypes.Int32.check)

				+ [pandera.dtypes.Int32.coerce](index.html#document-reference/generated/methods/pandera.dtypes.Int32.coerce)

				+ [pandera.dtypes.Int32.coerce\_value](index.html#document-reference/generated/methods/pandera.dtypes.Int32.coerce_value)

				+ [pandera.dtypes.Int32.try\_coerce](index.html#document-reference/generated/methods/pandera.dtypes.Int32.try_coerce)

				+ [pandera.dtypes.Int32.\_\_call\_\_](index.html#document-reference/generated/methods/pandera.dtypes.Int32.__call__)

			* [pandera.dtypes.Int64](index.html#document-reference/generated/pandera.dtypes.Int64)

				+ [pandera.dtypes.Int64.\_\_init\_\_](index.html#document-reference/generated/methods/pandera.dtypes.Int64.__init__)

				+ [pandera.dtypes.Int64.check](index.html#document-reference/generated/methods/pandera.dtypes.Int64.check)

				+ [pandera.dtypes.Int64.coerce](index.html#document-reference/generated/methods/pandera.dtypes.Int64.coerce)

				+ [pandera.dtypes.Int64.coerce\_value](index.html#document-reference/generated/methods/pandera.dtypes.Int64.coerce_value)

				+ [pandera.dtypes.Int64.try\_coerce](index.html#document-reference/generated/methods/pandera.dtypes.Int64.try_coerce)

				+ [pandera.dtypes.Int64.\_\_call\_\_](index.html#document-reference/generated/methods/pandera.dtypes.Int64.__call__)

			* [pandera.dtypes.UInt](index.html#document-reference/generated/pandera.dtypes.UInt)

				+ [pandera.dtypes.UInt.\_\_init\_\_](index.html#document-reference/generated/methods/pandera.dtypes.UInt.__init__)

				+ [pandera.dtypes.UInt.check](index.html#document-reference/generated/methods/pandera.dtypes.UInt.check)

				+ [pandera.dtypes.UInt.coerce](index.html#document-reference/generated/methods/pandera.dtypes.UInt.coerce)

				+ [pandera.dtypes.UInt.coerce\_value](index.html#document-reference/generated/methods/pandera.dtypes.UInt.coerce_value)

				+ [pandera.dtypes.UInt.try\_coerce](index.html#document-reference/generated/methods/pandera.dtypes.UInt.try_coerce)

				+ [pandera.dtypes.UInt.\_\_call\_\_](index.html#document-reference/generated/methods/pandera.dtypes.UInt.__call__)

			* [pandera.dtypes.UInt8](index.html#document-reference/generated/pandera.dtypes.UInt8)

				+ [pandera.dtypes.UInt8.\_\_init\_\_](index.html#document-reference/generated/methods/pandera.dtypes.UInt8.__init__)

				+ [pandera.dtypes.UInt8.check](index.html#document-reference/generated/methods/pandera.dtypes.UInt8.check)

				+ [pandera.dtypes.UInt8.coerce](index.html#document-reference/generated/methods/pandera.dtypes.UInt8.coerce)

				+ [pandera.dtypes.UInt8.coerce\_value](index.html#document-reference/generated/methods/pandera.dtypes.UInt8.coerce_value)

				+ [pandera.dtypes.UInt8.try\_coerce](index.html#document-reference/generated/methods/pandera.dtypes.UInt8.try_coerce)

				+ [pandera.dtypes.UInt8.\_\_call\_\_](index.html#document-reference/generated/methods/pandera.dtypes.UInt8.__call__)

			* [pandera.dtypes.UInt16](index.html#document-reference/generated/pandera.dtypes.UInt16)

				+ [pandera.dtypes.UInt16.\_\_init\_\_](index.html#document-reference/generated/methods/pandera.dtypes.UInt16.__init__)

				+ [pandera.dtypes.UInt16.check](index.html#document-reference/generated/methods/pandera.dtypes.UInt16.check)

				+ [pandera.dtypes.UInt16.coerce](index.html#document-reference/generated/methods/pandera.dtypes.UInt16.coerce)

				+ [pandera.dtypes.UInt16.coerce\_value](index.html#document-reference/generated/methods/pandera.dtypes.UInt16.coerce_value)

				+ [pandera.dtypes.UInt16.try\_coerce](index.html#document-reference/generated/methods/pandera.dtypes.UInt16.try_coerce)

				+ [pandera.dtypes.UInt16.\_\_call\_\_](index.html#document-reference/generated/methods/pandera.dtypes.UInt16.__call__)

			* [pandera.dtypes.UInt32](index.html#document-reference/generated/pandera.dtypes.UInt32)

				+ [pandera.dtypes.UInt32.\_\_init\_\_](index.html#document-reference/generated/methods/pandera.dtypes.UInt32.__init__)

				+ [pandera.dtypes.UInt32.check](index.html#document-reference/generated/methods/pandera.dtypes.UInt32.check)

				+ [pandera.dtypes.UInt32.coerce](index.html#document-reference/generated/methods/pandera.dtypes.UInt32.coerce)

				+ [pandera.dtypes.UInt32.coerce\_value](index.html#document-reference/generated/methods/pandera.dtypes.UInt32.coerce_value)

				+ [pandera.dtypes.UInt32.try\_coerce](index.html#document-reference/generated/methods/pandera.dtypes.UInt32.try_coerce)

				+ [pandera.dtypes.UInt32.\_\_call\_\_](index.html#document-reference/generated/methods/pandera.dtypes.UInt32.__call__)

			* [pandera.dtypes.UInt64](index.html#document-reference/generated/pandera.dtypes.UInt64)

				+ [pandera.dtypes.UInt64.\_\_init\_\_](index.html#document-reference/generated/methods/pandera.dtypes.UInt64.__init__)

				+ [pandera.dtypes.UInt64.check](index.html#document-reference/generated/methods/pandera.dtypes.UInt64.check)

				+ [pandera.dtypes.UInt64.coerce](index.html#document-reference/generated/methods/pandera.dtypes.UInt64.coerce)

				+ [pandera.dtypes.UInt64.coerce\_value](index.html#document-reference/generated/methods/pandera.dtypes.UInt64.coerce_value)

				+ [pandera.dtypes.UInt64.try\_coerce](index.html#document-reference/generated/methods/pandera.dtypes.UInt64.try_coerce)

				+ [pandera.dtypes.UInt64.\_\_call\_\_](index.html#document-reference/generated/methods/pandera.dtypes.UInt64.__call__)

			* [pandera.dtypes.Complex](index.html#document-reference/generated/pandera.dtypes.Complex)

				+ [pandera.dtypes.Complex.\_\_init\_\_](index.html#document-reference/generated/methods/pandera.dtypes.Complex.__init__)

				+ [pandera.dtypes.Complex.check](index.html#document-reference/generated/methods/pandera.dtypes.Complex.check)

				+ [pandera.dtypes.Complex.coerce](index.html#document-reference/generated/methods/pandera.dtypes.Complex.coerce)

				+ [pandera.dtypes.Complex.coerce\_value](index.html#document-reference/generated/methods/pandera.dtypes.Complex.coerce_value)

				+ [pandera.dtypes.Complex.try\_coerce](index.html#document-reference/generated/methods/pandera.dtypes.Complex.try_coerce)

				+ [pandera.dtypes.Complex.\_\_call\_\_](index.html#document-reference/generated/methods/pandera.dtypes.Complex.__call__)

			* [pandera.dtypes.Complex64](index.html#document-reference/generated/pandera.dtypes.Complex64)

				+ [pandera.dtypes.Complex64.\_\_init\_\_](index.html#document-reference/generated/methods/pandera.dtypes.Complex64.__init__)

				+ [pandera.dtypes.Complex64.check](index.html#document-reference/generated/methods/pandera.dtypes.Complex64.check)

				+ [pandera.dtypes.Complex64.coerce](index.html#document-reference/generated/methods/pandera.dtypes.Complex64.coerce)

				+ [pandera.dtypes.Complex64.coerce\_value](index.html#document-reference/generated/methods/pandera.dtypes.Complex64.coerce_value)

				+ [pandera.dtypes.Complex64.try\_coerce](index.html#document-reference/generated/methods/pandera.dtypes.Complex64.try_coerce)

				+ [pandera.dtypes.Complex64.\_\_call\_\_](index.html#document-reference/generated/methods/pandera.dtypes.Complex64.__call__)

			* [pandera.dtypes.Complex128](index.html#document-reference/generated/pandera.dtypes.Complex128)

				+ [pandera.dtypes.Complex128.\_\_init\_\_](index.html#document-reference/generated/methods/pandera.dtypes.Complex128.__init__)

				+ [pandera.dtypes.Complex128.check](index.html#document-reference/generated/methods/pandera.dtypes.Complex128.check)

				+ [pandera.dtypes.Complex128.coerce](index.html#document-reference/generated/methods/pandera.dtypes.Complex128.coerce)

				+ [pandera.dtypes.Complex128.coerce\_value](index.html#document-reference/generated/methods/pandera.dtypes.Complex128.coerce_value)

				+ [pandera.dtypes.Complex128.try\_coerce](index.html#document-reference/generated/methods/pandera.dtypes.Complex128.try_coerce)

				+ [pandera.dtypes.Complex128.\_\_call\_\_](index.html#document-reference/generated/methods/pandera.dtypes.Complex128.__call__)

			* [pandera.dtypes.Complex256](index.html#document-reference/generated/pandera.dtypes.Complex256)

				+ [pandera.dtypes.Complex256.\_\_init\_\_](index.html#document-reference/generated/methods/pandera.dtypes.Complex256.__init__)

				+ [pandera.dtypes.Complex256.check](index.html#document-reference/generated/methods/pandera.dtypes.Complex256.check)

				+ [pandera.dtypes.Complex256.coerce](index.html#document-reference/generated/methods/pandera.dtypes.Complex256.coerce)

				+ [pandera.dtypes.Complex256.coerce\_value](index.html#document-reference/generated/methods/pandera.dtypes.Complex256.coerce_value)

				+ [pandera.dtypes.Complex256.try\_coerce](index.html#document-reference/generated/methods/pandera.dtypes.Complex256.try_coerce)

				+ [pandera.dtypes.Complex256.\_\_call\_\_](index.html#document-reference/generated/methods/pandera.dtypes.Complex256.__call__)

			* [pandera.dtypes.Decimal](index.html#document-reference/generated/pandera.dtypes.Decimal)

				+ [pandera.dtypes.Decimal.\_\_init\_\_](index.html#document-reference/generated/methods/pandera.dtypes.Decimal.__init__)

				+ [pandera.dtypes.Decimal.check](index.html#document-reference/generated/methods/pandera.dtypes.Decimal.check)

				+ [pandera.dtypes.Decimal.coerce](index.html#document-reference/generated/methods/pandera.dtypes.Decimal.coerce)

				+ [pandera.dtypes.Decimal.coerce\_value](index.html#document-reference/generated/methods/pandera.dtypes.Decimal.coerce_value)

				+ [pandera.dtypes.Decimal.try\_coerce](index.html#document-reference/generated/methods/pandera.dtypes.Decimal.try_coerce)

				+ [pandera.dtypes.Decimal.\_\_call\_\_](index.html#document-reference/generated/methods/pandera.dtypes.Decimal.__call__)

			* [pandera.dtypes.String](index.html#document-reference/generated/pandera.dtypes.String)

				+ [pandera.dtypes.String.\_\_init\_\_](index.html#document-reference/generated/methods/pandera.dtypes.String.__init__)

				+ [pandera.dtypes.String.check](index.html#document-reference/generated/methods/pandera.dtypes.String.check)

				+ [pandera.dtypes.String.coerce](index.html#document-reference/generated/methods/pandera.dtypes.String.coerce)

				+ [pandera.dtypes.String.coerce\_value](index.html#document-reference/generated/methods/pandera.dtypes.String.coerce_value)

				+ [pandera.dtypes.String.try\_coerce](index.html#document-reference/generated/methods/pandera.dtypes.String.try_coerce)

				+ [pandera.dtypes.String.\_\_call\_\_](index.html#document-reference/generated/methods/pandera.dtypes.String.__call__)

		- [Pandas Dtypes](index.html#pandas-dtypes)

			* [pandera.engines.pandas\_engine.BOOL](index.html#document-reference/generated/pandera.engines.pandas_engine.BOOL)

				+ [pandera.engines.pandas\_engine.BOOL.\_\_init\_\_](index.html#document-reference/generated/methods/pandera.engines.pandas_engine.BOOL.__init__)

				+ [pandera.engines.pandas\_engine.BOOL.check](index.html#document-reference/generated/methods/pandera.engines.pandas_engine.BOOL.check)

				+ [pandera.engines.pandas\_engine.BOOL.coerce](index.html#document-reference/generated/methods/pandera.engines.pandas_engine.BOOL.coerce)

				+ [pandera.engines.pandas\_engine.BOOL.coerce\_value](index.html#document-reference/generated/methods/pandera.engines.pandas_engine.BOOL.coerce_value)

				+ [pandera.engines.pandas\_engine.BOOL.try\_coerce](index.html#document-reference/generated/methods/pandera.engines.pandas_engine.BOOL.try_coerce)

				+ [pandera.engines.pandas\_engine.BOOL.\_\_call\_\_](index.html#document-reference/generated/methods/pandera.engines.pandas_engine.BOOL.__call__)

			* [pandera.engines.pandas\_engine.INT8](index.html#document-reference/generated/pandera.engines.pandas_engine.INT8)

				+ [pandera.engines.pandas\_engine.INT8.\_\_init\_\_](index.html#document-reference/generated/methods/pandera.engines.pandas_engine.INT8.__init__)

				+ [pandera.engines.pandas\_engine.INT8.check](index.html#document-reference/generated/methods/pandera.engines.pandas_engine.INT8.check)

				+ [pandera.engines.pandas\_engine.INT8.coerce](index.html#document-reference/generated/methods/pandera.engines.pandas_engine.INT8.coerce)

				+ [pandera.engines.pandas\_engine.INT8.coerce\_value](index.html#document-reference/generated/methods/pandera.engines.pandas_engine.INT8.coerce_value)

				+ [pandera.engines.pandas\_engine.INT8.try\_coerce](index.html#document-reference/generated/methods/pandera.engines.pandas_engine.INT8.try_coerce)

				+ [pandera.engines.pandas\_engine.INT8.\_\_call\_\_](index.html#document-reference/generated/methods/pandera.engines.pandas_engine.INT8.__call__)

			* [pandera.engines.pandas\_engine.INT16](index.html#document-reference/generated/pandera.engines.pandas_engine.INT16)

				+ [pandera.engines.pandas\_engine.INT16.\_\_init\_\_](index.html#document-reference/generated/methods/pandera.engines.pandas_engine.INT16.__init__)

				+ [pandera.engines.pandas\_engine.INT16.check](index.html#document-reference/generated/methods/pandera.engines.pandas_engine.INT16.check)

				+ [pandera.engines.pandas\_engine.INT16.coerce](index.html#document-reference/generated/methods/pandera.engines.pandas_engine.INT16.coerce)

				+ [pandera.engines.pandas\_engine.INT16.coerce\_value](index.html#document-reference/generated/methods/pandera.engines.pandas_engine.INT16.coerce_value)

				+ [pandera.engines.pandas\_engine.INT16.try\_coerce](index.html#document-reference/generated/methods/pandera.engines.pandas_engine.INT16.try_coerce)

				+ [pandera.engines.pandas\_engine.INT16.\_\_call\_\_](index.html#document-reference/generated/methods/pandera.engines.pandas_engine.INT16.__call__)

			* [pandera.engines.pandas\_engine.INT32](index.html#document-reference/generated/pandera.engines.pandas_engine.INT32)

				+ [pandera.engines.pandas\_engine.INT32.\_\_init\_\_](index.html#document-reference/generated/methods/pandera.engines.pandas_engine.INT32.__init__)

				+ [pandera.engines.pandas\_engine.INT32.check](index.html#document-reference/generated/methods/pandera.engines.pandas_engine.INT32.check)

				+ [pandera.engines.pandas\_engine.INT32.coerce](index.html#document-reference/generated/methods/pandera.engines.pandas_engine.INT32.coerce)

				+ [pandera.engines.pandas\_engine.INT32.coerce\_value](index.html#document-reference/generated/methods/pandera.engines.pandas_engine.INT32.coerce_value)

				+ [pandera.engines.pandas\_engine.INT32.try\_coerce](index.html#document-reference/generated/methods/pandera.engines.pandas_engine.INT32.try_coerce)

				+ [pandera.engines.pandas\_engine.INT32.\_\_call\_\_](index.html#document-reference/generated/methods/pandera.engines.pandas_engine.INT32.__call__)

			* [pandera.engines.pandas\_engine.INT64](index.html#document-reference/generated/pandera.engines.pandas_engine.INT64)

				+ [pandera.engines.pandas\_engine.INT64.\_\_init\_\_](index.html#document-reference/generated/methods/pandera.engines.pandas_engine.INT64.__init__)

				+ [pandera.engines.pandas\_engine.INT64.check](index.html#document-reference/generated/methods/pandera.engines.pandas_engine.INT64.check)

				+ [pandera.engines.pandas\_engine.INT64.coerce](index.html#document-reference/generated/methods/pandera.engines.pandas_engine.INT64.coerce)

				+ [pandera.engines.pandas\_engine.INT64.coerce\_value](index.html#document-reference/generated/methods/pandera.engines.pandas_engine.INT64.coerce_value)

				+ [pandera.engines.pandas\_engine.INT64.try\_coerce](index.html#document-reference/generated/methods/pandera.engines.pandas_engine.INT64.try_coerce)

				+ [pandera.engines.pandas\_engine.INT64.\_\_call\_\_](index.html#document-reference/generated/methods/pandera.engines.pandas_engine.INT64.__call__)

			* [pandera.engines.pandas\_engine.UINT8](index.html#document-reference/generated/pandera.engines.pandas_engine.UINT8)

				+ [pandera.engines.pandas\_engine.UINT8.\_\_init\_\_](index.html#document-reference/generated/methods/pandera.engines.pandas_engine.UINT8.__init__)

				+ [pandera.engines.pandas\_engine.UINT8.check](index.html#document-reference/generated/methods/pandera.engines.pandas_engine.UINT8.check)

				+ [pandera.engines.pandas\_engine.UINT8.coerce](index.html#document-reference/generated/methods/pandera.engines.pandas_engine.UINT8.coerce)

				+ [pandera.engines.pandas\_engine.UINT8.coerce\_value](index.html#document-reference/generated/methods/pandera.engines.pandas_engine.UINT8.coerce_value)

				+ [pandera.engines.pandas\_engine.UINT8.try\_coerce](index.html#document-reference/generated/methods/pandera.engines.pandas_engine.UINT8.try_coerce)

				+ [pandera.engines.pandas\_engine.UINT8.\_\_call\_\_](index.html#document-reference/generated/methods/pandera.engines.pandas_engine.UINT8.__call__)

			* [pandera.engines.pandas\_engine.UINT16](index.html#document-reference/generated/pandera.engines.pandas_engine.UINT16)

				+ [pandera.engines.pandas\_engine.UINT16.\_\_init\_\_](index.html#document-reference/generated/methods/pandera.engines.pandas_engine.UINT16.__init__)

				+ [pandera.engines.pandas\_engine.UINT16.check](index.html#document-reference/generated/methods/pandera.engines.pandas_engine.UINT16.check)

				+ [pandera.engines.pandas\_engine.UINT16.coerce](index.html#document-reference/generated/methods/pandera.engines.pandas_engine.UINT16.coerce)

				+ [pandera.engines.pandas\_engine.UINT16.coerce\_value](index.html#document-reference/generated/methods/pandera.engines.pandas_engine.UINT16.coerce_value)

				+ [pandera.engines.pandas\_engine.UINT16.try\_coerce](index.html#document-reference/generated/methods/pandera.engines.pandas_engine.UINT16.try_coerce)

				+ [pandera.engines.pandas\_engine.UINT16.\_\_call\_\_](index.html#document-reference/generated/methods/pandera.engines.pandas_engine.UINT16.__call__)

			* [pandera.engines.pandas\_engine.UINT32](index.html#document-reference/generated/pandera.engines.pandas_engine.UINT32)

				+ [pandera.engines.pandas\_engine.UINT32.\_\_init\_\_](index.html#document-reference/generated/methods/pandera.engines.pandas_engine.UINT32.__init__)

				+ [pandera.engines.pandas\_engine.UINT32.check](index.html#document-reference/generated/methods/pandera.engines.pandas_engine.UINT32.check)

				+ [pandera.engines.pandas\_engine.UINT32.coerce](index.html#document-reference/generated/methods/pandera.engines.pandas_engine.UINT32.coerce)

				+ [pandera.engines.pandas\_engine.UINT32.coerce\_value](index.html#document-reference/generated/methods/pandera.engines.pandas_engine.UINT32.coerce_value)

				+ [pandera.engines.pandas\_engine.UINT32.try\_coerce](index.html#document-reference/generated/methods/pandera.engines.pandas_engine.UINT32.try_coerce)

				+ [pandera.engines.pandas\_engine.UINT32.\_\_call\_\_](index.html#document-reference/generated/methods/pandera.engines.pandas_engine.UINT32.__call__)

			* [pandera.engines.pandas\_engine.UINT64](index.html#document-reference/generated/pandera.engines.pandas_engine.UINT64)

				+ [pandera.engines.pandas\_engine.UINT64.\_\_init\_\_](index.html#document-reference/generated/methods/pandera.engines.pandas_engine.UINT64.__init__)

				+ [pandera.engines.pandas\_engine.UINT64.check](index.html#document-reference/generated/methods/pandera.engines.pandas_engine.UINT64.check)

				+ [pandera.engines.pandas\_engine.UINT64.coerce](index.html#document-reference/generated/methods/pandera.engines.pandas_engine.UINT64.coerce)

				+ [pandera.engines.pandas\_engine.UINT64.coerce\_value](index.html#document-reference/generated/methods/pandera.engines.pandas_engine.UINT64.coerce_value)

				+ [pandera.engines.pandas\_engine.UINT64.try\_coerce](index.html#document-reference/generated/methods/pandera.engines.pandas_engine.UINT64.try_coerce)

				+ [pandera.engines.pandas\_engine.UINT64.\_\_call\_\_](index.html#document-reference/generated/methods/pandera.engines.pandas_engine.UINT64.__call__)

			* [pandera.engines.pandas\_engine.STRING](index.html#document-reference/generated/pandera.engines.pandas_engine.STRING)

				+ [pandera.engines.pandas\_engine.STRING.\_\_init\_\_](index.html#document-reference/generated/methods/pandera.engines.pandas_engine.STRING.__init__)

				+ [pandera.engines.pandas\_engine.STRING.check](index.html#document-reference/generated/methods/pandera.engines.pandas_engine.STRING.check)

				+ [pandera.engines.pandas\_engine.STRING.coerce](index.html#document-reference/generated/methods/pandera.engines.pandas_engine.STRING.coerce)

				+ [pandera.engines.pandas\_engine.STRING.coerce\_value](index.html#document-reference/generated/methods/pandera.engines.pandas_engine.STRING.coerce_value)

				+ [pandera.engines.pandas\_engine.STRING.from\_parametrized\_dtype](index.html#document-reference/generated/methods/pandera.engines.pandas_engine.STRING.from_parametrized_dtype)

				+ [pandera.engines.pandas\_engine.STRING.try\_coerce](index.html#document-reference/generated/methods/pandera.engines.pandas_engine.STRING.try_coerce)

				+ [pandera.engines.pandas\_engine.STRING.\_\_call\_\_](index.html#document-reference/generated/methods/pandera.engines.pandas_engine.STRING.__call__)

			* [pandera.engines.numpy\_engine.Object](index.html#document-reference/generated/pandera.engines.numpy_engine.Object)

				+ [pandera.engines.numpy\_engine.Object.\_\_init\_\_](index.html#document-reference/generated/methods/pandera.engines.numpy_engine.Object.__init__)

				+ [pandera.engines.numpy\_engine.Object.check](index.html#document-reference/generated/methods/pandera.engines.numpy_engine.Object.check)

				+ [pandera.engines.numpy\_engine.Object.coerce](index.html#document-reference/generated/methods/pandera.engines.numpy_engine.Object.coerce)

				+ [pandera.engines.numpy\_engine.Object.coerce\_value](index.html#document-reference/generated/methods/pandera.engines.numpy_engine.Object.coerce_value)

				+ [pandera.engines.numpy\_engine.Object.try\_coerce](index.html#document-reference/generated/methods/pandera.engines.numpy_engine.Object.try_coerce)

				+ [pandera.engines.numpy\_engine.Object.\_\_call\_\_](index.html#document-reference/generated/methods/pandera.engines.numpy_engine.Object.__call__)

			* [pandera.engines.pandas\_engine.DateTime](index.html#document-reference/generated/pandera.engines.pandas_engine.DateTime)

			* [pandera.engines.pandas\_engine.Date](index.html#document-reference/generated/pandera.engines.pandas_engine.Date)

				+ [pandera.engines.pandas\_engine.Date.\_\_init\_\_](index.html#document-reference/generated/methods/pandera.engines.pandas_engine.Date.__init__)

				+ [pandera.engines.pandas\_engine.Date.check](index.html#document-reference/generated/methods/pandera.engines.pandas_engine.Date.check)

				+ [pandera.engines.pandas\_engine.Date.coerce](index.html#document-reference/generated/methods/pandera.engines.pandas_engine.Date.coerce)

				+ [pandera.engines.pandas\_engine.Date.coerce\_value](index.html#document-reference/generated/methods/pandera.engines.pandas_engine.Date.coerce_value)

				+ [pandera.engines.pandas\_engine.Date.try\_coerce](index.html#document-reference/generated/methods/pandera.engines.pandas_engine.Date.try_coerce)

				+ [pandera.engines.pandas\_engine.Date.\_\_call\_\_](index.html#document-reference/generated/methods/pandera.engines.pandas_engine.Date.__call__)

			* [pandera.engines.pandas\_engine.Decimal](index.html#document-reference/generated/pandera.engines.pandas_engine.Decimal)

				+ [pandera.engines.pandas\_engine.Decimal.\_\_init\_\_](index.html#document-reference/generated/methods/pandera.engines.pandas_engine.Decimal.__init__)

				+ [pandera.engines.pandas\_engine.Decimal.check](index.html#document-reference/generated/methods/pandera.engines.pandas_engine.Decimal.check)

				+ [pandera.engines.pandas\_engine.Decimal.coerce](index.html#document-reference/generated/methods/pandera.engines.pandas_engine.Decimal.coerce)

				+ [pandera.engines.pandas\_engine.Decimal.coerce\_value](index.html#document-reference/generated/methods/pandera.engines.pandas_engine.Decimal.coerce_value)

				+ [pandera.engines.pandas\_engine.Decimal.try\_coerce](index.html#document-reference/generated/methods/pandera.engines.pandas_engine.Decimal.try_coerce)

				+ [pandera.engines.pandas\_engine.Decimal.\_\_call\_\_](index.html#document-reference/generated/methods/pandera.engines.pandas_engine.Decimal.__call__)

			* [pandera.engines.pandas\_engine.Category](index.html#document-reference/generated/pandera.engines.pandas_engine.Category)

				+ [pandera.engines.pandas\_engine.Category.\_\_init\_\_](index.html#document-reference/generated/methods/pandera.engines.pandas_engine.Category.__init__)

				+ [pandera.engines.pandas\_engine.Category.check](index.html#document-reference/generated/methods/pandera.engines.pandas_engine.Category.check)

				+ [pandera.engines.pandas\_engine.Category.coerce](index.html#document-reference/generated/methods/pandera.engines.pandas_engine.Category.coerce)

				+ [pandera.engines.pandas\_engine.Category.coerce\_value](index.html#document-reference/generated/methods/pandera.engines.pandas_engine.Category.coerce_value)

				+ [pandera.engines.pandas\_engine.Category.from\_parametrized\_dtype](index.html#document-reference/generated/methods/pandera.engines.pandas_engine.Category.from_parametrized_dtype)

				+ [pandera.engines.pandas\_engine.Category.try\_coerce](index.html#document-reference/generated/methods/pandera.engines.pandas_engine.Category.try_coerce)

				+ [pandera.engines.pandas\_engine.Category.\_\_call\_\_](index.html#document-reference/generated/methods/pandera.engines.pandas_engine.Category.__call__)

		- [GeoPandas Dtypes](index.html#geopandas-dtypes)

			* [pandera.engines.pandas\_engine.Geometry](index.html#document-reference/generated/pandera.engines.pandas_engine.Geometry)

				+ [pandera.engines.pandas\_engine.Geometry.\_\_init\_\_](index.html#document-reference/generated/methods/pandera.engines.pandas_engine.Geometry.__init__)

				+ [pandera.engines.pandas\_engine.Geometry.check](index.html#document-reference/generated/methods/pandera.engines.pandas_engine.Geometry.check)

				+ [pandera.engines.pandas\_engine.Geometry.coerce](index.html#document-reference/generated/methods/pandera.engines.pandas_engine.Geometry.coerce)

				+ [pandera.engines.pandas\_engine.Geometry.coerce\_value](index.html#document-reference/generated/methods/pandera.engines.pandas_engine.Geometry.coerce_value)

				+ [pandera.engines.pandas\_engine.Geometry.try\_coerce](index.html#document-reference/generated/methods/pandera.engines.pandas_engine.Geometry.try_coerce)

				+ [pandera.engines.pandas\_engine.Geometry.\_\_call\_\_](index.html#document-reference/generated/methods/pandera.engines.pandas_engine.Geometry.__call__)

		- [Pydantic Dtypes](index.html#pydantic-dtypes)

			* [pandera.engines.pandas\_engine.PydanticModel](index.html#document-reference/generated/pandera.engines.pandas_engine.PydanticModel)

				+ [pandera.engines.pandas\_engine.PydanticModel.\_\_init\_\_](index.html#document-reference/generated/methods/pandera.engines.pandas_engine.PydanticModel.__init__)

				+ [pandera.engines.pandas\_engine.PydanticModel.check](index.html#document-reference/generated/methods/pandera.engines.pandas_engine.PydanticModel.check)

				+ [pandera.engines.pandas\_engine.PydanticModel.coerce](index.html#document-reference/generated/methods/pandera.engines.pandas_engine.PydanticModel.coerce)

				+ [pandera.engines.pandas\_engine.PydanticModel.coerce\_value](index.html#document-reference/generated/methods/pandera.engines.pandas_engine.PydanticModel.coerce_value)

				+ [pandera.engines.pandas\_engine.PydanticModel.try\_coerce](index.html#document-reference/generated/methods/pandera.engines.pandas_engine.PydanticModel.try_coerce)

				+ [pandera.engines.pandas\_engine.PydanticModel.\_\_call\_\_](index.html#document-reference/generated/methods/pandera.engines.pandas_engine.PydanticModel.__call__)

		- [Utility functions](index.html#utility-functions)

			* [pandera.dtypes.is\_subdtype](index.html#document-reference/generated/pandera.dtypes.is_subdtype)

			* [pandera.dtypes.is\_float](index.html#document-reference/generated/pandera.dtypes.is_float)

			* [pandera.dtypes.is\_int](index.html#document-reference/generated/pandera.dtypes.is_int)

			* [pandera.dtypes.is\_uint](index.html#document-reference/generated/pandera.dtypes.is_uint)

			* [pandera.dtypes.is\_complex](index.html#document-reference/generated/pandera.dtypes.is_complex)

			* [pandera.dtypes.is\_numeric](index.html#document-reference/generated/pandera.dtypes.is_numeric)

			* [pandera.dtypes.is\_bool](index.html#document-reference/generated/pandera.dtypes.is_bool)

			* [pandera.dtypes.is\_string](index.html#document-reference/generated/pandera.dtypes.is_string)

			* [pandera.dtypes.is\_datetime](index.html#document-reference/generated/pandera.dtypes.is_datetime)

			* [pandera.dtypes.is\_timedelta](index.html#document-reference/generated/pandera.dtypes.is_timedelta)

			* [pandera.dtypes.immutable](index.html#document-reference/generated/pandera.dtypes.immutable)

		- [Engines](index.html#engines)

			* [pandera.engines.engine.Engine](index.html#document-reference/generated/pandera.engines.engine.Engine)

				+ [pandera.engines.engine.Engine.dtype](index.html#document-reference/generated/methods/pandera.engines.engine.Engine.dtype)

				+ [pandera.engines.engine.Engine.get\_registered\_dtypes](index.html#document-reference/generated/methods/pandera.engines.engine.Engine.get_registered_dtypes)

				+ [pandera.engines.engine.Engine.register\_dtype](index.html#document-reference/generated/methods/pandera.engines.engine.Engine.register_dtype)

				+ [pandera.engines.engine.Engine.\_\_call\_\_](index.html#document-reference/generated/methods/pandera.engines.engine.Engine.__call__)

			* [pandera.engines.numpy\_engine.Engine](index.html#document-reference/generated/pandera.engines.numpy_engine.Engine)

				+ [pandera.engines.numpy\_engine.Engine.dtype](index.html#document-reference/generated/methods/pandera.engines.numpy_engine.Engine.dtype)

			* [pandera.engines.pandas\_engine.Engine](index.html#document-reference/generated/pandera.engines.pandas_engine.Engine)

				+ [pandera.engines.pandas\_engine.Engine.dtype](index.html#document-reference/generated/methods/pandera.engines.pandas_engine.Engine.dtype)

				+ [pandera.engines.pandas\_engine.Engine.numpy\_dtype](index.html#document-reference/generated/methods/pandera.engines.pandas_engine.Engine.numpy_dtype)

	+ [Schema Models](index.html#document-reference/schema_models)

		- [Schema Model](index.html#schema-model)

			* [pandera.model.SchemaModel](index.html#document-reference/generated/pandera.model.SchemaModel)

				+ [pandera.model.SchemaModel.example](index.html#document-reference/generated/methods/pandera.model.SchemaModel.example)

				+ [pandera.model.SchemaModel.strategy](index.html#document-reference/generated/methods/pandera.model.SchemaModel.strategy)

				+ [pandera.model.SchemaModel.to\_schema](index.html#document-reference/generated/methods/pandera.model.SchemaModel.to_schema)

				+ [pandera.model.SchemaModel.to\_yaml](index.html#document-reference/generated/methods/pandera.model.SchemaModel.to_yaml)

				+ [pandera.model.SchemaModel.validate](index.html#document-reference/generated/methods/pandera.model.SchemaModel.validate)

		- [Model Components](index.html#model-components)

			* [pandera.model\_components.Field](index.html#document-reference/generated/pandera.model_components.Field)

			* [pandera.model\_components.check](index.html#document-reference/generated/pandera.model_components.check)

			* [pandera.model\_components.dataframe\_check](index.html#document-reference/generated/pandera.model_components.dataframe_check)

		- [Typing](index.html#typing)

			* [pandera.typing](index.html#document-reference/generated/pandera.typing)

				+ [pandera.typing.fastapi.UploadFile](index.html#document-reference/generated/generated/pandera.typing.fastapi.UploadFile)

					- [pandera.typing.fastapi.UploadFile.\_\_init\_\_](index.html#document-reference/generated/generated/methods/pandera.typing.fastapi.UploadFile.__init__)

					- [pandera.typing.fastapi.UploadFile.pydantic\_validate](index.html#document-reference/generated/generated/methods/pandera.typing.fastapi.UploadFile.pydantic_validate)

				+ [pandera.typing.formats.Formats](index.html#document-reference/generated/generated/pandera.typing.formats.Formats)

		- [Config](index.html#config)

			* [pandera.model.BaseConfig](index.html#document-reference/generated/pandera.model.BaseConfig)

	+ [Decorators](index.html#document-reference/decorators)

		- [pandera.decorators.check\_input](index.html#document-reference/generated/pandera.decorators.check_input)

		- [pandera.decorators.check\_output](index.html#document-reference/generated/pandera.decorators.check_output)

		- [pandera.decorators.check\_io](index.html#document-reference/generated/pandera.decorators.check_io)

		- [pandera.decorators.check\_types](index.html#document-reference/generated/pandera.decorators.check_types)

	+ [Schema Inference](index.html#document-reference/schema_inference)

		- [pandera.schema\_inference.infer\_schema](index.html#document-reference/generated/pandera.schema_inference.infer_schema)

	+ [IO Utilities](index.html#document-reference/io)

		- [pandera.io.from\_yaml](index.html#document-reference/generated/pandera.io.from_yaml)

		- [pandera.io.to\_yaml](index.html#document-reference/generated/pandera.io.to_yaml)

		- [pandera.io.to\_script](index.html#document-reference/generated/pandera.io.to_script)

	+ [Data Synthesis Strategies](index.html#document-reference/strategies)

		- [pandera.strategies](index.html#document-reference/generated/pandera.strategies)

	+ [Extensions](index.html#document-reference/extensions)

		- [pandera.extensions](index.html#document-reference/generated/pandera.extensions)

	+ [Errors](index.html#document-reference/errors)

		- [pandera.errors.SchemaError](index.html#document-reference/generated/pandera.errors.SchemaError)

		- [pandera.errors.SchemaErrors](index.html#document-reference/generated/pandera.errors.SchemaErrors)

		- [pandera.errors.SchemaInitError](index.html#document-reference/generated/pandera.errors.SchemaInitError)

		- [pandera.errors.SchemaDefinitionError](index.html#document-reference/generated/pandera.errors.SchemaDefinitionError)

Community

* [Contributing](index.html#document-CONTRIBUTING)

	+ [Getting Started](index.html#getting-started)

	+ [Contributing to the Codebase](index.html#contributing-to-the-codebase)

		- [Environment Setup](index.html#environment-setup)

			* [Option 1: `miniconda` Setup](index.html#option-1-miniconda-setup)

			* [Option 2: `virtualenv` Setup](index.html#option-2-virtualenv-setup)

			* [Run Tests](index.html#run-tests)

			* [Build Documentation Locally](index.html#build-documentation-locally)

			* [Adding New Dependencies](index.html#adding-new-dependencies)

			* [Set up `pre-commit`](index.html#set-up-pre-commit)

		- [Making Changes](index.html#making-changes)

		- [Run the Full Test Suite Locally](index.html#run-the-full-test-suite-locally)

			* [Using `mamba` (optional)](index.html#using-mamba-optional)

		- [Project Releases](index.html#project-releases)

		- [Contributing Documentation](index.html#contributing-documentation)

		- [Contributing Bugfixes](index.html#contributing-bugfixes)

		- [Contributing Enhancements](index.html#contributing-enhancements)

		- [Making Pull Requests](index.html#making-pull-requests)

			* [Bugfixes](index.html#bugfixes)

			* [Documentation](index.html#documentation)

			* [Enhancements](index.html#enhancements)

		- [Questions, Ideas, General Discussion](index.html#questions-ideas-general-discussion)

		- [Dataframe Schema Style Guides](index.html#dataframe-schema-style-guides)

	+ [Deprecation policy](index.html#deprecation-policy)









JupyterLite

























JupyterLite Retro - Tree





JupyterLite Retro - Console





JupyterLite Retro - Edit





JupyterLite Retro - Notebook





JupyterLite

