-
-
Notifications
You must be signed in to change notification settings - Fork 18.5k
ENH: dt.day_of_week should return int8 #58185
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
Comments
For pyarrow types, this would probably be a better enhancement request to pyarrow as it just uses |
take |
Hi @WillAyd I'm trying to work on the implementation for this issue and I'm getting a little lost here. It looks like when a DateTimeArray is initialized, day_of_week is automatically created as an int32 type, and I'm not seeing any way to change that in the Python code. I dug a bit deeper and it looks like I may need to make some changes to the underlying ccalendar.pxd and ccalendar.pyx files used for Datetime objects. Specifically, the dayofweek function. Would you agree that I'll need to make changes in the underlying Cython code? Or am I going down a rabbit hole? |
@WillAyd From what I can tell, Looking at similar PRs, it looks like all DatetimeArray attributes are treated as int32 type, which tells me that I'll need to just modify day_of_week. Which leads me to believe that the simplest way to do this would be to modify ccalendar files in pandas._libs.tslibs to return what I assume to be the Cython equivalent of Looking at DatetimeIndex attributes, it looks like a good number of these fields could be |
Hey @rmhowe425 thanks for taking a look. I'm not sure of all the places that need to be updated, but yes I expect the core of the issue will need to be tackled in Cython. If you get somewhat close I would advise just pushing up a draft PR for discussion; usually easier to discuss and advise that way |
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.
pyarrow dates return int64:
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
The text was updated successfully, but these errors were encountered: