Open
Description
Feature Type
-
Adding new functionality to pandas
-
Changing existing functionality in pandas
-
Removing existing functionality in pandas
Problem Description
For NumPy types today this returns int32.
In [3]: pd.Series(["2024-01-01", "2024-01-02", "2024-01-03"], dtype="datetime64[us]").dt.day_of_week
Out[3]:
0 0
1 1
2 2
dtype: int32
pyarrow dates return int64:
In [18]: pa_arr = pa.array([
...: datetime.date(2024, 1, 1),
...: datetime.date(2024, 1, 2),
...: datetime.date(2024, 1, 3),
...: ])
...: ser = pd.Series(pa_arr, dtype=pd.ArrowDtype(pa.date32()))
In [19]: ser.dt.day_of_week
Out[19]:
0 0
1 1
2 2
dtype: int64[pyarrow]
Feature Description
Both could reasonably return int8 or even uint8 since the domain values are 0-6
Alternative Solutions
status quo
Additional Context
No response