Open cgebbe opened 2 years ago
hi @cgebbe, this is related to #820 . I'd say this is sort of a bug, but more of an enhancement/feature request (the fact that only single dataframe outputs are supported should be better documented...)
The workaround for this would be to use check_output
, which is a little more flexible:
@pa.check_types
@pa.check_output(OutputSchema.to_schema(), 0) # validate the 0th index of the output, assume __get_item__ support
def transform(df: DataFrame[InputSchema]) -> Tuple[DataFrame[OutputSchema], int]: # you can keep this for annotation's sake
return df.assign(revenue_WRONG=100.0), 1
In any case, would welcome a PR to support this use case with @pa.check_types type annotations!
When the script below is executed, Then I would have expected an error that "revenue_WRONG" does not conform to the OutputSchema. However, no error is raised using pandera 0.10.1 and python 3.8.10.