-
-
Notifications
You must be signed in to change notification settings - Fork 18.3k
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
DOC: DateOffset.is_anchored track down intention, fix docstring #55388
Comments
I'll start looking into the GH history and based on what I have found, then make a PR if it is warranted or come back here with my findings if intent and correct is ambiguous. |
take |
Hi @jbrockmendel, I have been looking through the pandas historical releases code and have gone back as far as v0.18.0 where isAnchored was still in use and the code for `DateOffset.isAnchored is as follows:
The above provides even less detail information about what the use case would be for the class DateOffset. And @jbrockmendel your comment that, "The method isn't used outside the tests and I doubt many users use it, ...", seems to be ringing true as I cannot determine a use case for this method, so I think depreciation may be the route to take but I will keep going back in GH history if you think it is necessary? Or I will go ahead and submit a PR to depreciate it if that is the correct course. |
Thanks for taking a look @tpackard1. I'm going to defer to @natmokval on this. |
@jbrockmendel, sorry for taking a while to get into this. I dug into the GH history and I found the first appearance of isAnchored
We define isAnchored in
and for classes DateOffset / BDay / BMonthEnd the definition is the same:
|
The first time Then in 2012, see commit 0cc1a3d0bc4617440e3df9e3e55b19cb6fb51a2d all definitions isAnchored were moved to offsets.py and we used isAnchored in _should_cache, which we called in constructor of class DatetimeIndex. Then in 2019, see commit 1d36851ffdc8391b8b60a7628ce5a536180ef13b we deprecated isAnchored and started to use is_anchored instead (there was no connection between |
Seems like now we don't use I think we can either deprecate |
Agreed let's deprecate this. |
The docstring on the base class is_anchored pretty clearly doesn't make sense in the non-base class methods, so I suspect it is wrong. It has never been clear to me exactly what the intention of is_anchored is, but my best guess is something like offsets that are "anchored" on a particular day of the week or month of the year or etc.
The task here is to dig into the GH history to determine if the intent and correct behavior was ever clear. If so, to fix the implementation and/or docstring (and then remove the comment). The method isn't used outside the tests and I doubt many users use it, so OK to deprecate if it isn't useful or doesn't make sense.
I suspect something like it can make sense and be useful for DatetimeIndex set operations to determine when we can use RangeIndex fastpaths, xref #44025.
For historical digging/grepping it may be useful to know that this used to be isAnchored.
The text was updated successfully, but these errors were encountered: