Skip to content

[Python] pandas Timestamp not supported in ListArray #15732

@asfimport

Description

@asfimport

It seems pandas Timestamps are supported in some places but not others. Specifically, they work in primitive Arrays but not ListArrays:

import pyarrow
from datetime import datetime

ts = [pd.Timestamp(2017, 1, 1, 12), pd.Timestamp(2018, 1, 1, 12)]
dt = [datetime(2017, 1, 1, 12), datetime(2018, 1, 1, 12)]

pyarrow.Table.from_pandas(pd.DataFrame(dict(dates=dt)))       # OK   :)
pyarrow.Table.from_pandas(pd.DataFrame(dict(dates=[dt, dt]))) # OK   :)
pyarrow.Table.from_pandas(pd.DataFrame(dict(dates=ts)))       # OK   :)
pyarrow.Table.from_pandas(pd.DataFrame(dict(dates=[ts, ts]))) # Fail :(

The above code results in: 


ArrowInvalid: Error inferring Arrow data type for collection of Python objects. Got Python object of type Timestamp but can only handle these types: bool, float, integer, date, datetime, bytes, unicode, decimal

 

I guess this should be supported?

 

Reporter: Thomas Buhrmann / @buhrmann

Note: This issue was originally created as ARROW-2706. Please see the migration documentation for further details.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions