Skip to content

Commit

Permalink
Avoid deprecated is_datetime64tz_dtype from pandas (#67)
Browse files Browse the repository at this point in the history
  • Loading branch information
jrbourbeau committed Apr 17, 2023
1 parent af83b69 commit 9db50c1
Showing 1 changed file with 1 addition and 7 deletions.
8 changes: 1 addition & 7 deletions partd/pandas.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down

0 comments on commit 9db50c1

Please sign in to comment.