-
-
Notifications
You must be signed in to change notification settings - Fork 311
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Validating datetime columns regardless of timezone #1543
Comments
Hi @robertdj can you provide a code sample of the code you're working with? |
Looking at the polars docs, could you use |
Thanks for your quick answer! I was actually using class MySchema(pa.DataFrameModel):
timestamp: datetime But good point with using Polars' datetime. This seems to be equivalent: class MySchema(pa.DataFrameModel):
timestamp: pl.Datetime(time_zone=None) Unfortunately, the docs say that if |
I think another way to handle this would be to override the Does this make sense, or is the |
I think your suggestion sounds like a much better default! |
Have you had time to consider this @cosmicBboy ? |
One last thought: would it be too cumbersome to import the pandera data type instead? from pandera.engines.polars_engine import DateTime
class MySchema(pa.DataFrameModel):
timestamp: DateTime(tz_agnostic=True) My main concern is that with my prior suggestion is that there would be no way to validate datetime types that don't have timezones:
If someone wanted to validate that a column is datetime and has no timezone, |
I think that is a good point. I'm fine with importing |
I am using Pandera with the new Polars plugin, which is really exciting.
I am validating a schema, where one of the columns is a
Datetime
. I don't care if theDatetime
has a timezone or not.However, Pandera appears to be strict about whether or not there is a timezone. Is it possible ignore the presence of a timezone?
I suppose this could be handled with a union of type as in this issue: #1152
Although I fear that I then have to provide all possible allowed time zones?
The text was updated successfully, but these errors were encountered: