DOC: to_pylist returns a pandas.Timestamp instead of datetime.datetime when the type is timestamp[ns]
- Dominant language
- C++
- Stars
- 17.1k
- Forks
- 4.3k
- Avg merge
- 3d 18h
- Merged PRs (30d)
- 91
Description
### Describe the enhancement requested
```
In [2]: import pyarrow as pa; from datetime import datetime
In [4]: pa.array([datetime(2023, 1, 1)], type=pa.timestamp("ns")).to_pylist()
Out[4]: [Timestamp('2023-01-01 00:00:00')]
```
From the docs, I assumed `Convert to a list of native Python objects.` means I should always expected a `datetime.datetime`object, but since I suppose it cannot handle nanosecond components this method returns a `pandas.Timestamp` when the unit is `"ns"`
### Component(s)
Python
Contributor guide
Research direction
Start by reproducing the pa.array(..., type=pa.timestamp("ns")).to_pylist() example from the issue and inspect the Python conversion path for timestamp[ns] values. Check the documentation wording for to_pylist and existing tests around timestamp conversion; done means the returned type and its documentation agree for nanosecond timestamps.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- pandas, python
- Domain
- data
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100