pandera.model_components.Field

pandera.model_components.Field(*, eq=None, ne=None, gt=None, ge=None, lt=None, le=None, in_range=None, isin=None, notin=None, str_contains=None, str_endswith=None, str_length=None, str_matches=None, str_startswith=None, nullable=False, unique=False, allow_duplicates=None, coerce=False, regex=False, ignore_na=True, raise_warning=False, n_failure_cases=10, alias=None, check_name=None, dtype_kwargs=None, **kwargs)[source]

Used to provide extra information about a field of a SchemaModel.

new in 0.5.0

Some arguments apply only to numeric dtypes and some apply only to str. See the User Guide for more information.

The keyword-only arguments from eq to str_startswith are dispatched to the built-in ~pandera.checks.Check methods.

Parameters
  • nullable (bool) – Whether or not the column/index can contain null values.

  • unique (bool) – Whether column values should be unique.

  • allow_duplicates (Optional[bool]) –

    Whether or not column can contain duplicate values.

    Warning

    This option will be deprecated in 0.8.0. Use the unique argument instead.

  • coerce (bool) – coerces the data type if True.

  • regex (bool) – whether or not the field name or alias is a regex pattern.

  • ignore_na (bool) – whether or not to ignore null values in the checks.

  • raise_warning (bool) – raise a warning instead of an Exception.

  • n_failure_cases (int) – report the first n unique failure cases. If None, report all failure cases.

  • alias (Optional[Any]) – The public name of the column/index.

  • check_name (Optional[bool]) – Whether to check the name of the column/index during validation. None is the default behavior, which translates to True for columns and multi-index, and to False for a single index.

  • dtype_kwargs (Optional[Dict[str, Any]]) – The parameters to be forwarded to the type of the field.

  • kwargs – Specify custom checks that have been registered with the register_check_method decorator.

Return type

Any