pandera.schema_components.Index#
- class pandera.schema_components.Index(dtype=None, checks=None, nullable=False, unique=False, report_duplicates='all', coerce=False, name=None, title=None, description=None)[source]#
Validate types and properties of a DataFrame Index.
Initialize series schema base object.
- Parameters
dtype (
Union
[str
,type
,DataType
,Type
,ExtensionDtype
,dtype
,None
]) – datatype of the column. If a string is specified, then assumes one of the valid pandas string values: http://pandas.pydata.org/pandas-docs/stable/basics.html#dtypeschecks (
Union
[Check
,Hypothesis
,List
[Union
[Check
,Hypothesis
]],None
]) –If element_wise is True, then callable signature should be:
Callable[Any, bool]
where theAny
input is a scalar element in the column. Otherwise, the input is assumed to be a pandas.Series object.nullable (bool) – Whether or not column can contain null values.
unique (
bool
) – whether column values should be unique.report_duplicates (
Union
[Literal
[‘exclude_first’],Literal
[‘exclude_last’],Literal
[‘all’]]) – how to report unique errors - exclude_first: report all duplicates except first occurence - exclude_last: report all duplicates except last occurence - 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 (
Optional
[Any
]) – column name in dataframe to validate.title (
Optional
[str
]) – A human-readable label for the series.description (
Optional
[str
]) – An arbitrary textual description of the series.
Attributes
checks
Return list of checks or hypotheses.
coerce
Whether to coerce series to specified type.
description
An arbitrary textual description of the series.
dtype
Get the pandas dtype
name
Get SeriesSchema name.
names
Get index names in the Index schema component.
nullable
Whether the series is nullable.
title
A human-readable label for the series.
unique
Whether to check for duplicates in check object
Methods
Generate an example of a particular size.
Create a
hypothesis
strategy for generating an Index.Generate column data object for use by MultiIndex strategy.
Validate DataFrameSchema or SeriesSchema Index.
Alias for
validate
method.