Basic example#

Pandera Schema#

from pandera import Column, DataFrameSchema, Index

basic_schema = DataFrameSchema(
    {
        "field1": Column(
            int, title="Field 1 Title", description="My field description"
        ),
    },
    index=Index(int),
    strict=True,
    coerce=True,
    description="First data model for testing purposes",
)
pandera schema target.basic_schema.basic_schema#

First data model for testing purposes

Schema Configuration:
  • coerce = True

  • ordered = False

  • strict = True

column field1: int64, Field 1 Title#

My field description

Constraints:
  • nullable = False

  • unique = False

  • coerce = False

  • required = True

.. autopandera_schema:: target.basic_schema.basic_schema

NB: If you want to use markdown with myst-parser, use the eval-rst directive.

Pandera Model#

import pandera as pa


class TestModel(pa.DataFrameModel):
    """
    First data model for testing purposes
    """

    field1: int = pa.Field(
        title="Field 1 Title",
        description="My field description",
    )
pandera model target.basic_model.TestModel[source]#

First data model for testing purposes

column field1: int, Field 1 Title#

My field description

Constraints:
  • nullable = False

  • unique = False

  • coerce = False

  • required = True

class Config#
coerce: bool#

coerce types of all schema components

ordered: bool#

validate columns order

strict: StrictType#

make sure all specified columns are in the validated dataframe - if "filter", removes columns not specified in the schema

.. autopandera_model:: target.basic_model.TestModel

NB: If you want to use markdown with myst-parser, use the eval-rst directive.