pandera.api.pandas.components.Index¶
- class pandera.api.pandas.components.Index(dtype=None, checks=None, parsers=None, nullable=False, unique=False, report_duplicates='all', coerce=False, name=None, title=None, description=None, default=None, metadata=None, drop_invalid_rows=False)[source]¶
Validate types and properties of a pandas DataFrame Index.
Initialize array schema.
- Parameters:
checks (
Union[Check,list[Union[Check,Hypothesis]],None]) –If element_wise is True, then callable signature should be:
Callable[Any, bool]where theAnyinput is a scalar element in the column. Otherwise, the input is assumed to be a the data object (Series, DataFrame).nullable (
bool) – Whether or not column can contain null values.unique (
bool) – Whether or not column can contain duplicate values.report_duplicates (
Union[Literal[‘exclude_first’],Literal[‘exclude_last’],Literal[‘all’]]) – how to report unique errors - exclude_first: report all duplicates except first occurrence - exclude_last: report all duplicates except last occurrence - all: (default) report all duplicatescoerce (
bool) – If True, when schema.validate is called the column will be coerced into the specified dtype. This has no effect on columns wheredtype=None.name (
Any) – column name in dataframe to validate.title (
UnionType[str,None]) – A human-readable label for the series.description (
UnionType[str,None]) – An arbitrary textual description of the series.metadata (
UnionType[dict,None]) – An optional key-value data.default (
UnionType[Any,None]) – The default value for missing values in the series.drop_invalid_rows (
bool) – if True, drop invalid rows on validation.
Attributes
BACKEND_REGISTRYdtypeGet the pandas dtype
namesGet index names in the Index schema component.
propertiesGet the properties of the schema for serialization purposes.
Methods