Skip to content

BUG: Pandas extension Int dtypes break dataframe interchange protocol #56777

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
3 tasks done
WillAyd opened this issue Jan 8, 2024 · 1 comment
Closed
3 tasks done
Labels
Bug Interchange Dataframe Interchange Protocol

Comments

@WillAyd
Copy link
Member

WillAyd commented Jan 8, 2024

Pandas version checks

  • I have checked that this issue has not already been reported.

  • I have confirmed this bug exists on the latest version of pandas.

  • I have confirmed this bug exists on the main branch of pandas.

Reproducible Example

>>> import pandas as pd
>>> df = pd.DataFrame([[1,]], columns=["a"], dtype="Int64")
>>> df.__dataframe__().get_column(0).get_buffers()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/willayd/clones/pandas/pandas/core/interchange/column.py", line 247, in get_buffers
    "data": self._get_data_buffer(),
  File "/home/willayd/clones/pandas/pandas/core/interchange/column.py", line 270, in _get_data_buffer
    if self.dtype[0] in (
  File "properties.pyx", line 36, in pandas._libs.properties.CachedProperty.__get__
  File "/home/willayd/clones/pandas/pandas/core/interchange/column.py", line 128, in dtype
    return self._dtype_from_pandasdtype(dtype)
  File "/home/willayd/clones/pandas/pandas/core/interchange/column.py", line 147, in _dtype_from_pandasdtype
    byteorder = dtype.byteorder
AttributeError: 'Int64Dtype' object has no attribute 'byteorder'

Issue Description

Integral extension types should still be serializable via the interchange protocol

Expected Behavior

Should return proper buffers

Installed Versions

on main

@WillAyd WillAyd added Bug Needs Triage Issue that has not been reviewed by a pandas team member Interchange Dataframe Interchange Protocol and removed Needs Triage Issue that has not been reviewed by a pandas team member labels Jan 8, 2024
@MarcoGorelli
Copy link
Member

thanks Will for reporting this - going to close as duplicate of #55069 , there's a fix open anyway

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Interchange Dataframe Interchange Protocol
Projects
None yet
Development

No branches or pull requests

2 participants