What is the best way to handle dates in a SchemaModel? #835
-
Question about panderaIs there a way to specify specify a brute force / naive coercion approach for a series to end up with vanilla dates (no tz info)? I prefer to use the class based The reason I ask is I have been starting to use this library for validation (and coercion) as my data flows through a pipeline and I am using the following model to ensure the output at the end is a date column and a float column. However, using Thanks in advance! |
Beta Was this translation helpful? Give feedback.
Replies: 5 comments 2 replies
-
|
I have tried the following 2 approaches, neither work (both result in the same error):
|
Beta Was this translation helpful? Give feedback.
-
|
Just to add to the info. I am very confused because when I print out the schema I get the following: So the schema is expecting a |
Beta Was this translation helpful? Give feedback.
-
|
Hi @moleary-earnest you'll need to specify coerce=True at the column level (or in the Config definition) for pandera to coerce incoming data. Lemme know if that works! |
Beta Was this translation helpful? Give feedback.
-
|
Converting this into a discussion question. @moleary-earnest please mark my answer as the correct one if it solved your problem! |
Beta Was this translation helpful? Give feedback.
-
|
This worked for me: created_date: Series[Annotated[pd.DatetimeTZDtype, "ns", "UTC"]] |
Beta Was this translation helpful? Give feedback.
Hi @moleary-earnest you'll need to specify coerce=True at the column level (or in the Config definition) for pandera to coerce incoming data. Lemme know if that works!