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 2 replies
-
yep! You can use class Schema(pa.DataFrameModel):
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.
2 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
index: https://pandera.readthedocs.io/en/stable/dataframe_models.html#multiindex