Skip to content

[Python] Add temporal unit checking in NumPyDtypeUnifier #48625

@HyukjinKwon

Description

@HyukjinKwon

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

// TODO: check that units are all the same

For example,

import pyarrow as pa
import numpy as np
pa.array([np.datetime64('2020-01-01', 's'), np.datetime64('2020-01-02', 'ms')])

fails with somewhat a confusing error message:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "pyarrow/array.pxi", line 375, in pyarrow.lib.array
  File "pyarrow/array.pxi", line 46, in pyarrow.lib._sequence_to_array
  File "pyarrow/error.pxi", line 155, in pyarrow.lib.pyarrow_internal_check_status
  File "pyarrow/error.pxi", line 92, in pyarrow.lib.check_status
pyarrow.lib.ArrowNotImplementedError: Expected np.datetime64 but got: timestamp[ms]

Component(s)

Python

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions