<s> """<STR_LIT>""" <EOL> from itertools import chain , cycle <EOL> import numpy as np <EOL> import pandas as pd <EOL> def verify ( df , check , * args , ** kwargs ) : <EOL> """<STR_LIT>""" <EOL> result = check ( df , * args , ** kwargs ) <EOL> try : <EOL> assert result <EOL> except AssertionError as e : <EOL> msg = '<STR_LIT>' . format ( check . __name__ ) <EOL> e . args = ( msg , df ) <EOL> raise <EOL> return df <EOL> def verify_all ( df , check , * args , ** kwargs ) : <EOL> """<STR_LIT>""" <EOL> result = check ( df , * args , ** kwargs ) <EOL> try : <EOL> assert np . all ( result ) <EOL> except AssertionError as e : <EOL> msg = "<STR_LIT>" . format ( check . __name__ ) <EOL> e . args = ( msg , df [ ~ result ] ) <EOL> raise <EOL> return df <EOL> def verify_any ( df , check , * args , ** kwargs ) : <EOL> """<STR_LIT>""" <EOL> result = check ( df , * args , ** kwargs ) <EOL> try : <EOL> assert np . any ( result ) <EOL> except AssertionError as e : <EOL> msg = '<STR_LIT>' . format ( check . __name__ ) <EOL> e . args = ( msg , df ) <EOL> raise <EOL> return df <EOL> def bad_locations ( df ) : <EOL> columns = df . columns <EOL> all_locs = chain . from_iterable ( zip ( df . index , cycle ( [ col ] ) ) for col in columns ) <EOL> bad = pd . Series ( list ( all_locs ) ) [ np . asarray ( df ) . ravel ( <NUM_LIT:1> ) ] <EOL> msg = bad . values <EOL> return msg <EOL> __all__ = [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ] </s>
