Skip to content

DOC: to_pylist returns a pandas.Timestamp instead of datetime.datetime when the type is timestamp[ns] #34614

@mroeschke

Description

@mroeschke

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.datetimeobject, but since I suppose it cannot handle nanosecond components this method returns a pandas.Timestamp when the unit is "ns"

Component(s)

Python

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions