How to validate index using SchemaModel #905
-
I can validate a DataFrame index using the DataFrameSchema like this:
Is there a way to do the same using a SchemaModel? |
Beta Was this translation helpful? Give feedback.
Answered by
cosmicBboy
Aug 6, 2022
Replies: 1 comment
-
yep! You can use 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 |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
a0th
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
yep! You can use
pa.typing.Index
to type-annotate an index.See how you can validate a
MultiIndex
inxex: https://pandera.readthedocs.io/en/stable/schema_models.html#multiindex