Skip to content

BUG: Fix ArrowDtype.itemsize for fixed-width types #62182

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

george-adams1
Copy link

@george-adams1 george-adams1 commented Aug 24, 2025

Fixes #57948

Summary

ArrowDtype.itemsize was incorrectly returning 8 bytes for date32[day] and other fixed-width PyArrow types because it always fell back to numpy_dtype.itemsize. This PR uses PyArrow's bit_width for fixed-width types and gracefully falls back to numpy for variable-width types.

Changes

  • Modified ArrowDtype.itemsize to use pyarrow_dtype.bit_width when available
  • Added comprehensive regression test covering the fix

Example

Before: ArrowDtype(pa.date32()).itemsize == 8
After: ArrowDtype(pa.date32()).itemsize == 4

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

Successfully merging this pull request may close these issues.

BUG: itemsize wrong for date32[day][pyarrow] dtype?
1 participant