-
-
Notifications
You must be signed in to change notification settings - Fork 18.7k
Open
Labels
Arrowpyarrow functionalitypyarrow functionalityDatetimeDatetime data dtypeDatetime data dtypeEnhancementNeeds DiscussionRequires discussion from core team before further actionRequires discussion from core team before further action
Description
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
miohtama
Metadata
Metadata
Assignees
Labels
Arrowpyarrow functionalitypyarrow functionalityDatetimeDatetime data dtypeDatetime data dtypeEnhancementNeeds DiscussionRequires discussion from core team before further actionRequires discussion from core team before further action