Skip to content

Nested Datatypes specified in schema #825

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

You must be logged in to vote

you can use object as the dtype, and then use custom checks to validate stuff about that column

# define schema
schema = pa.DataFrameSchema({
    "column0": pa.Column(
        object,
        checks=pa.Check(lambda element: all(isinstance(x, int) for x in element), element_wise=True)
    ),
    "column1": pa.Column(int, checks=pa.Check.le(10)),
    "column3": pa.Column(str),
})

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by cosmicBboy
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
question Further information is requested
2 participants
Converted from issue

This discussion was converted from issue #823 on April 07, 2022 19:25.