-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
ENH: return .dt.weekday/isoweekday/month_name/day_name as ordered categoricals #12993
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
xfref #12806 I realized as merging #12803 that we didn't actually have to do this in cython and instead is a trivial map operation.
|
And if you categorize its even easier (and way more efficient)
|
I don't know what the speed implications are for big dataframes. In any On Tue, Apr 26, 2016 at 6:52 AM, Jeff Reback [email protected]
|
@BastiaanBergman no, what I mean is that THIS impl is trivial. Of course the cython is not :< |
I would think they shouldn't be ordered (because it's cyclic). An order would probably only enable |
well also allows comparisons, e.g.
|
I'd like to give this a try. Can I work on this? |
Go for it @sivakar12! Some of the files you may want to edit are in this recent PR https://github.com/pandas-dev/pandas/pull/18164/files |
I found that categorical is not defined in the Cython code. So I focused on the DatetimeIndex class, tried calling as_type, returning a CategoricalIndex from the _field_accessor method there. They are not working and I always end up getting dtype: object. What am I missing? |
After the index is created, you can either use the |
I made |
Feel free to open a pull request (you can mark it as a work in progress) with your initial changes. It will be easier for us to review and help debug the issue. |
Not wild about making DatetimeArray have a dependency on Categorical (which in turn has dependency on Index) |
this would be an indirect dependency and is for user convenience |
#12803 added
.dt.weekday_name
. I think its appropriate to return this (and.weekday
) as ordered categoricalsThe text was updated successfully, but these errors were encountered: