-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
ENH: Standardized timeseries accessor names, #9606 #11489
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
Conversation
For |
@jorisvandenbossche I think we should deprecate the original ones in 0.18 anyhow (eg daysinmonth) |
dayofyear = _field_accessor('dayofyear', 'doy', "The ordinal day of the year") | ||
day_of_year = dayofyear | ||
quarter = _field_accessor('quarter', 'q', "The quarter of the date") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let's switch the impl to the new names (and make the original ones aliases)
that way they are easy to remove
Maybe we could also remove these from the dir to avoid all the duplicates in tab completion? |
there is a test in test_series for dt accessor that needs updating as well |
yep @jorisvandenbossche agreed |
I think choosing one prefered name per attribute, and remove all others from the docs (only mentioning them somewhere as being aliases) and tab completion, is maybe a less 'aggresive' way for striving for consistency instead of really deprecating them |
sure that's fine too |
@emilydolson you will need to define def _dir_deletions() which returns a set of the attributes to remove |
I've got the tab completion fixed for DatetimeIndex and PeriodIndex, but defining |
so the issue here is that So here is what we need to do. Move from long-story-short this will then work. |
can you rebase / update also let's deprecate the old names (e.g. w/o the underscores). You will need to put the warning in the accessor (and probably create a specific function/property for them in order to do this as they are defined by the |
can you update |
@emilydolson can you rebase/update according to comments |
1 similar comment
@emilydolson can you rebase/update according to comments |
closing, but pls reopen if you'd like to update, which would be great. |
In accordance with #9606, I added
day_of_week
andday_of_year
accessors to DatetimeIndex, Timestamp, and Period. Since #9606 didn't mentionweekofyear
, and there's alreadyweek
as a replacement for that, I didn't add aweek_of_year
, but I'm happy to.I updated the tests and docs, but this is my first PR to pandas involving actual code, so let me know if I missed anything.