From 599f8f7fb6b5838d1b1b826782179ce4f640cf17 Mon Sep 17 00:00:00 2001 From: Daniel van der Ende Date: Sun, 19 May 2019 13:54:08 +0200 Subject: [PATCH] Significantly speed up timezone validator --- opulent_pandas/validator.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/opulent_pandas/validator.py b/opulent_pandas/validator.py index 413641a..5327d58 100644 --- a/opulent_pandas/validator.py +++ b/opulent_pandas/validator.py @@ -139,7 +139,7 @@ class TimezoneValidator(BaseValidator): """ def validate(self, df_column: pd.Series): - if not (df_column.apply(lambda x: x.tz is not None)).all(): + if not df_column.dt.tz: raise MissingTimezoneError( f"Non-timezone-aware dates found for column: {df_column.name}." )