pandera icon indicating copy to clipboard operation
pandera copied to clipboard

Check the return value with @pa.check_types

Open pprados opened this issue 2 years ago • 0 comments

Question about pandera

With this sample

class Link1_schema(pa.SchemaModel):
        id: pa.typing.Index[int]
        data: pa.typing.Series[int]
        class Config:
            strict = True
            ordered = True

@pa.check_types
def f(data:pd.DataFrame[Link1_schema]) -> pd.DataFrame[Link1_schema]:
    #Link1_schema.validate(data)
    data['data']='error'
    return data


d=pa.typing.DataFrame[Link1_schema]({"data":[1,2]})
f(d)

The return value was not checked. If I add @pa.check_output(Link1_schema) the error was found.

How I can check the return value with only the @pa.check_types ?

pprados avatar Jul 18 '22 08:07 pprados