Skip to content

How to validate index using SchemaModel #905

Answered by cosmicBboy
a0th asked this question in Q&A
Discussion options

You must be logged in to vote

yep! You can use pa.typing.Index to type-annotate an index.

class Schema(pa.SchemaModel):
    column1: pa.typing.Series[int]
    index_name: pa.typing.Index[int] = pa.Field(check_name=True)

See how you can validate a MultiIndex inxex: https://pandera.readthedocs.io/en/stable/schema_models.html#multiindex

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by a0th
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants