apache / apache/arrow

[Python] Conversion from numpy datetime64 array with multiple of unit (eg [10s]) gives wrong values

Open
#39,756 0 comments 0 reactions 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.

The unit in numpy can be a multiple of the base unit. For example:

```python
>>> arr = np.arange("2012-01-01 00:00", "2012-01-01 00:01", dtype="datetime64[10s]")
>>> arr
array(['2012-01-01T00:00:00', '2012-01-01T00:00:10',
'2012-01-01T00:00:20', '2012-01-01T00:00:30',
'2012-01-01T00:00:40', '2012-01-01T00:00:50'],
dtype='datetime64[10s]')

>>> pa.array(arr)

[
1974-03-15 00:00:00,
1974-03-15 00:00:01,
1974-03-15 00:00:02,
1974-03-15 00:00:03,
1974-03-15 00:00:04,
1974-03-15 00:00:05
]
```

### 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.