Skip to content
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

Relax validation check for datetime #99

Merged
merged 1 commit into from
Nov 13, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions focus_validator/rules/checks.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from datetime import datetime
from typing import Union

import numpy as np
import pandas as pd
from pandera import extensions

Expand Down Expand Up @@ -48,11 +49,10 @@ def __validate_date_obj__(value: Union[str, datetime]):
# failed to parse iso string
return False

if not isinstance(value, datetime):
return False

# match timezone to ensure datetime is in UTC
return value.tzname() == "UTC"
if isinstance(value, datetime):
return value.tzname() == "UTC"
else:
return isinstance(value, np.datetime64)

return pd.Series(map(__validate_date_obj__, pandas_obj.values))

Expand Down
Loading