Skip to content

Incompatible with pandas 2.1.0: AttributeError: module 'pandas.core.dtypes.dtypes' has no attribute 'PandasDtype' #199

@burnpanck

Description

@burnpanck

It appears that something moved inside pandas recently, and now pint_pandas cannot be imported anymore.

This is with pandas 2.1.0 (released today) and pint_pandas 0.4.0.

Full traceback:

import pint_pandas
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
Cell In[1], line 1
----> 1 import pint_pandas

File ~/.pyenv/versions/3.11.3/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/pint_pandas/__init__.py:3
      1 import pprint
----> 3 from .pint_array import PintArray, PintType
      5 try:
      6     from importlib.metadata import version

File ~/.pyenv/versions/3.11.3/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/pint_pandas/pint_array.py:198
    178         """
    179         Return a string representation for this object.
    180 
    181         Invoked by unicode(df) in py2 only. Yields a Unicode String in both
    182         py2/py3.
    183         """
    185         return self.name
    188 dtypemap = {
    189     int: pd.Int64Dtype(),
    190     np.int64: pd.Int64Dtype(),
    191     np.int32: pd.Int32Dtype(),
    192     np.int16: pd.Int16Dtype(),
    193     np.int8: pd.Int8Dtype(),
    194     # np.float128: pd.Float128Dtype(),
    195     float: pd.Float64Dtype(),
    196     np.float64: pd.Float64Dtype(),
    197     np.float32: pd.Float32Dtype(),
--> 198     np.complex128: pd.core.dtypes.dtypes.PandasDtype("complex128"),
    199     np.complex64: pd.core.dtypes.dtypes.PandasDtype("complex64"),
    200     # np.float16: pd.Float16Dtype(),
    201 }
    202 dtypeunmap = {v: k for k, v in dtypemap.items()}
    205 class PintArray(ExtensionArray, ExtensionOpsMixin):

AttributeError: module 'pandas.core.dtypes.dtypes' has no attribute 'PandasDtype'

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions