pandera.schema_components.Index

class pandera.schema_components.Index(dtype=None, checks=None, nullable=False, unique=False, allow_duplicates=None, coerce=False, name=None, pandas_dtype=None)[source]

Validate types and properties of a DataFrame Index.

Initialize series schema base object.

Parameters

Warning

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

Parameters
  • coerce (bool) – If True, when schema.validate is called the column will be coerced into the specified dtype. This has no effect on columns where dtype=None.

  • name (Optional[Any]) – column name in dataframe to validate.

  • pandas_dtype (Union[str, type, DataType, ExtensionDtype, dtype, None]) –

    alias of dtype for backwards compatibility.

    Warning

    This option will be deprecated in 0.8.0

Attributes

allow_duplicates

Whether to allow duplicate values.

checks

Return list of checks or hypotheses.

coerce

Whether to coerce series to specified type.

dtype

Get the pandas dtype

name

Get SeriesSchema name.

names

Get index names in the Index schema component.

nullable

Whether the series is nullable.

unique

Whether to check for duplicates in check object

Methods

example

Generate an example of a particular size.

strategy

Create a hypothesis strategy for generating an Index.

strategy_component

Generate column data object for use by MultiIndex strategy.

validate

Validate DataFrameSchema or SeriesSchema Index.

__call__

Alias for validate method.