Skip to content

ENH: ArrowTemporalProperties' object has no attribute 'to_period' #59771

Open
@dbalabka

Description

@dbalabka

Feature Type

  • Adding new functionality to pandas

  • Changing existing functionality in pandas

  • Removing existing functionality in pandas

Problem Description

This request is related to #52321 and #52330. Currently, Arrow dtype does not support function: https://pandas.pydata.org/docs/reference/api/pandas.Series.to_period.html

Feature Description

The following script throws an error:

import pandas as pd
from datetime import datetime

s = pd.Series([datetime.now()], dtype='date32[pyarrow]')
s.dt.to_period('D')
AttributeError: 'ArrowTemporalProperties' object has no attribute 'to_period'

Alternative Solutions

Otherwise, it requires convert arrow type back to pandas type which is not efficient:

import pandas as pd
from datetime import datetime

s = pd.Series([datetime.now()], dtype='date32[pyarrow]')
pd.to_datetime(s).dt.to_period('D')

Additional Context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    Arrowpyarrow functionalityDatetimeDatetime data dtypeEnhancementNeeds DiscussionRequires discussion from core team before further action

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions