Skip to content

Use of deprecated pandas internal DatetimeTZBlock in for Flight #537

@spacewolfXfr

Description

@spacewolfXfr

When installing the latest version of traffic using conda, the Flight import fails due to the pandas library.

How to reproduce:

$ python
Python 3.12.13 | packaged by conda-forge | (main, Mar  5 2026, 16:50:00) [GCC 14.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import traffic
>>> traffic.__version__
'2.13'
>>> from traffic.core import Flight
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/mael/miniconda3/envs/ntraffic/lib/python3.12/site-packages/traffic/core/__init__.py", line 46, in <module>
    from .flight import Flight
  File "/home/mael/miniconda3/envs/ntraffic/lib/python3.12/site-packages/traffic/core/flight.py", line 41, in <module>
    from pandas.core.internals.blocks import DatetimeTZBlock
ImportError: cannot import name 'DatetimeTZBlock' from 'pandas.core.internals.blocks' (/home/mael/miniconda3/envs/ntraffic/lib/python3.12/site-packages/pandas/core/internals/blocks.py). Did you mean: 'DatetimeLikeBlock'?
>>> import pandas
>>> pandas.__version__
'3.0.1'

This is most likely since version 3.0.0 of pandas:

Removed Block, DatetimeTZBlock, ExtensionBlock, create_block_manager_from_blocks from pandas.core.internals and pandas.core.internals.api (GH 55139)

Based on this pandas issue, the fix would be to use pd.arrays.DatetimeArray (and in the meantime, force a pandas version to be less than 3.0.0)

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions