pandera
pandera copied to clipboard
Add documentation for type coercion behavior
Question about pandera
Is there a place in the docs that explains the difference between Coerce at column level vs coerce at schema level?
class Schema(pa.SchemaModel):
year: Series[int] = pa.Field(gt=2000, coerce=True)
month: Series[int] = pa.Field(ge=1, le=12, coerce=True)
day: Series[int] = pa.Field(ge=0, le=365, coerce=True)
class Config:
name = "BaseSchema"
strict = True
coerce = True
foo = "bar" # Interpreted as dataframe check
hey @bfmcneill the current behavior is that DataFrameSchema(coerce=True)
will override the coerce setting at the column/index level.
This is not currently explicitly documented anywhere. It would probably belong here right after
If you want to coerce all of the columns specified in the DataFrameSchema, you can specify the coerce argument with DataFrameSchema(..., coerce=True).
And also in the docstring here
A contribution on that front would be much appreciated, let me know if you want to contribute!