How to use pandera to validate non numeric columns against numeric datatype in schema and raise error #1672
Unanswered
soumen-ghosh
asked this question in
Q&A
Replies: 1 comment
-
I should NOT say this is the answer, but I am, for now, using the below work around by calling this method right after the pa_feature_schema.validate() call. However, I'll look forward to proper solution.
PS: I have used |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I'm trying pandera for the 1st time. How can I use pandera to validate dataframe columns to ensure errors are raised if data-type does not match against the schema?
Say, I have the schema defined as following -
And say, my dataframe is like following:
Since "ocean_proximity" in schema is of type
int64
but in the dataframe it isobject
, I want an error to be raised.However, when I try the below code, it does not raise any exception
How to achieve this?
Since the dataframe could be any random dataframe, I get the schema through a user config file. I'm not sure how to use DataFrameModel to define schema programmatically in such case.
Beta Was this translation helpful? Give feedback.
All reactions