From 76d3c3d23bd030fc508c113a4e6a34b1452825d6 Mon Sep 17 00:00:00 2001 From: Martin Durant Date: Mon, 23 Oct 2023 11:25:01 -0400 Subject: [PATCH] simplfiying suggestion --- fastparquet/dataframe.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fastparquet/dataframe.py b/fastparquet/dataframe.py index d51889d3..7c46a53f 100644 --- a/fastparquet/dataframe.py +++ b/fastparquet/dataframe.py @@ -195,7 +195,7 @@ def set_cats(values, i=i, col=col, **kwargs): values = Categorical.from_codes(codes=code, dtype=bvalues.dtype) - elif getattr(bvalues.dtype, 'tz', None): + elif isinstance(dtype, pd.DatetimeTZDtype): dt = "M8[ns]" if PANDAS_VERSION.major < 2 else f'M8[{bvalues.dtype.unit}]' values = np.zeros(shape=shape, dtype=dt) values = type(bvalues)._from_sequence(values, copy=False, dtype=bvalues.dtype)