apache / apache/arrow

[Python] Conversion of datetime.datetime to date32 type silently truncates

Open
#41,896 1 comment 1 reaction 0 assignees View on GitHub
Component: Python Type: bug
Dominant language
C++
Stars
17.1k
Forks
4.3k
Avg merge
3d 13h
Merged PRs (30d)
88

Description

### Describe the bug, including details regarding any error messages, version, and platform.

Issue in title - behavior looks like it just truncates the time component of the datetime:

```python
>>> import pyarrow as pa
>>> import datetime
>>> pa.scalar(datetime.datetime(2024, 1, 1, 1, 1, 1), pa.date32())

```

The silent truncation seems problematic though - should this just raise and force users to opt for `datetime.date` instead?

cc @PedroVerardo who helped find this downstream in pandas

### Component(s)

Python

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.