Pandas version checks
- [X] I have checked that this issue has not already been reported.
- [X] I have confirmed this bug exists on the latest version of pandas.
- [X] I have confirmed this bug exists on the main branch of pandas.
Reproducible Example
import pandas as pd
from datetime import datetime
s = pd.Series([datetime.now()], dtype='date32[pyarrow]')
s.dt.day
Out[17]:
0 31
dtype: int64[pyarrow]
s.dt.month
Out[18]:
0 3
dtype: int64[pyarrow]
s.dt.year
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
Cell In [19], line 1
----> 1 s.dt.year
AttributeError: 'ArrowTemporalProperties' object has no attribute 'year'
Issue Description
Hi,
Why isn't year
available as a property of .dt
of a date32
/date64
pyarrow series, although day
and month
is available? I have checked and there is a compute pyarrow function for year.
Expected Behavior
Can access year
via dt
of a date32
/date64
pyarrow series.
Installed Versions
Comment From: char101
Looks like these functions haven't been implemented yet in the ArrowExtensionArray class
iso_week(values, /, *[, memory_pool])
iso_year(values, /, *[, memory_pool])
millisecond(values, /, *[, memory_pool])
subsecond(values, /, *[, memory_pool])
us_week(values, /, *[, memory_pool])
us_year(values, /, *[, memory_pool])
week(values, /, *[, week_starts_monday, ...])
year(values, /, *[, memory_pool])
year_month_day(values, /, *[, memory_pool])
Comment From: jdb78
'days' etc are also missing for time deltas. Both should be easy to add and they are likely to break a lot of code if they are missing.
Comment From: MarcoGorelli
thanks for the report
Why isn't year available as a property of .dt of a date32/date64 pyarrow series, although day and month is available?
quite a lot still needs doing for pyarrow to be complete - if you're interested in helping out, that'd be fantastic, here's the contributing guide https://pandas.pydata.org/docs/dev/development/contributing.html
Comment From: mroeschke
Looks like these functions haven't been implemented yet in the ArrowExtensionArray class
Note not all pyarrow compute functions have related dt
accessor methodes
'days' etc are also missing for time deltas. Both should be easy to add and they are likely to break a lot of code if they are missing.
Pyarrow compute functions don't work on duration types currently https://github.com/pandas-dev/pandas/issues/52284