Skip to content
Discussion options

You must be logged in to vote

Hi @fabianoliver

The syntax DataFrame[TestSchema] is intended to help mypy linting but you still define a "regular" pandas DataFrame (notice that you import from pandera.typing). The only additions are type hints and support for pydantic.

You need to call validate to coerce: TestSchema.validate(df). The reason why we cannot implement the behavior you expected is that Pandera would need to override every DataFrame method that outputs a DataFrame to call validate before return.

re: funny effects. Line 2 of your example does not work, I think you meant df.date[0]. It's expected to have Timestamp type in a datetime64[ns] series, the documentation says

Timestamp is the pandas equivalent of py…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@fabianoliver
Comment options

Answer selected by fabianoliver
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants