From 9db50c117b27c9923a976b5a16c8b7d725b1ef93 Mon Sep 17 00:00:00 2001 From: James Bourbeau Date: Mon, 17 Apr 2023 16:31:12 -0500 Subject: [PATCH] Avoid deprecated `is_datetime64tz_dtype` from `pandas` (#67) --- partd/pandas.py | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/partd/pandas.py b/partd/pandas.py index a3e43b6..5a25c26 100644 --- a/partd/pandas.py +++ b/partd/pandas.py @@ -129,16 +129,10 @@ def index_from_header_bytes(header, bytes): def block_to_header_bytes(block): values = block.values - try: - # pandas >= 0.19 - from pandas.api.types import is_datetime64tz_dtype - except ImportError: - from pandas.core.common import is_datetime64tz_dtype - if isinstance(values, pd.Categorical): extension = ('categorical_type', (values.ordered, values.categories)) values = values.codes - elif is_datetime64tz_dtype(block): + elif isinstance(block, pd.DatetimeTZDtype): extension = ('datetime64_tz_type', (block.values.tzinfo,)) values = values.view('i8') elif is_extension_array_dtype(block.dtype) or is_extension_array(values):