Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
1 of 3 tasks
dbalabka opened this issue Sep 10, 2024 · 0 comments
Open
1 of 3 tasks

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

dbalabka opened this issue Sep 10, 2024 · 0 comments
Labels
Enhancement Needs Triage Issue that has not been reviewed by a pandas team member

Comments

@dbalabka
Copy link

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

@dbalabka dbalabka added Enhancement Needs Triage Issue that has not been reviewed by a pandas team member labels Sep 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement Needs Triage Issue that has not been reviewed by a pandas team member
Projects
None yet
Development

No branches or pull requests

1 participant