Skip to content

Conversation

@linicole74
Copy link

When finding a common type, return the original type if there is only one non-null type.
When getting the numpy datatype, return objects for date32 and date64 types.

#62343

nli307 added 2 commits October 29, 2025 20:42
…ly one common type. Return objects for date32 and date64 types when converting those types to numpy types.
# try a pyarrow dtype
from pandas.core.dtypes.dtypes import ArrowDtype
if isinstance(dtype, ArrowDtype):
return ArrowDtype(dtype)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we ever get here? Seems like these cases would be caught above

if pa.types.is_date32(self.pyarrow_dtype) or pa.types.is_date64(
self.pyarrow_dtype
):
# date32 and date64 are pyarrow timestamps but do not have a
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nitpick they are not "pyarrow timestamps"

):
# date32 and date64 are pyarrow timestamps but do not have a
# corresponding numpy dtype.
return np.dtype(object)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

np.datetime64[D] might be more reasonable?

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: _get_common_dtype with date32[pyarrow] and null[pyarrow]

2 participants