Skip to content

REF/block the implicit cast of datetime.datetime to pa.date32() #58855

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
wants to merge 2 commits into from
Closed

REF/block the implicit cast of datetime.datetime to pa.date32() #58855

wants to merge 2 commits into from

Conversation

PedroVerardo
Copy link

@PedroVerardo PedroVerardo commented May 29, 2024

The change I made probably doesn't change the entire problem because the code continues to cast all other pyarrow types.

@@ -427,6 +428,8 @@ def _box_pa_scalar(cls, value, pa_type: pa.DataType | None = None) -> pa.Scalar:
pa_scalar = value
elif isna(value):
pa_scalar = pa.scalar(None, type=pa_type)
elif pa_type == pa.date32() and isinstance(value, datetime.datetime):
Copy link
Member

Choose a reason for hiding this comment

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

@PedroVerardo this is a nice find, but if pyarrow supports it I don't think we should do anything special in pandas to handle this. Looks like we should just open the issue upstream

@WillAyd
Copy link
Member

WillAyd commented May 31, 2024

Really appreciate the research into this @PedroVerardo . From what you discovered the issue is upstream in pyarrow - I copied you on the issue there so let's close this and track upstream.

Sorry there is nothing to merge into pandas but once again thanks for your efforts on this

@WillAyd WillAyd closed this May 31, 2024
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: Assigning datetime to pa.date32() type array should raise
2 participants