Skip to content

BUG: to_pydatetime() -> 'pyarrow.lib.DataType' object has no attribute 'unit' #52812

Closed
@s-banach

Description

@s-banach

Pandas version checks

  • I have checked that this issue has not already been reported.

  • I have confirmed this bug exists on the latest version of pandas.

  • I have confirmed this bug exists on the main branch of pandas.

Reproducible Example

import polars as pl
import datetime

pl.Series([datetime.date(2022,12,31)]).to_pandas(use_pyarrow_extension_array=True).dt.to_pydatetime()

"""AttributeError: 'pyarrow.lib.DataType' object has no attribute 'unit'"""

Issue Description

For context, I was feeding a pandas DataFrame with pyarrow dtypes into the dash package, which called s.dt.to_pydatetime() on a date series s. Maybe the problem is dash's fault, but this seems like a pandas bug.

Expected Behavior

Return datetime objects as expected.

Installed Versions

ModuleNotFoundError: No module named 'PySide6'

Metadata

Metadata

Assignees

No one assigned

    Labels

    Arrowpyarrow functionalityBugError ReportingIncorrect or improved errors from pandas

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions