Skip to content

How to properly validate a series of lists? #1187

Closed Answered by typkrft
typkrft asked this question in Q&A
Discussion options

You must be logged in to vote

Looks like Check(element_wise=True) and a change to the regex_check to accept types other than series does the trick. Is there away to do this without element_wise though?

def regex_check(regex: str):
    def func(elem: Any):
        if isinstance(elem, str):
            return bool(match(regex, elem))
        
        if isinstance(elem, list):
            for item in elem:
                if not bool(match(regex, item)):
                    return False
            return True
    return func

Replies: 1 comment

Comment options

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