-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
DOC: Add examples to frequency classes and methods #48011
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
@@ -559,6 +607,20 @@ cdef class BaseOffset: | |||
|
|||
@cache_readonly | |||
def freqstr(self) -> str: | |||
""" | |||
Return a string representing the frequency. |
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.
How does this differ from the name
? i.e. is there a diff between,
>>> pd.offsets.Hour(5).name # which is "H" in above example
>>> pd.offsets.Hour(5).freqstr
?
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.
AFAIU: name
is the "base" frequency unit (H), and freqstr
is the entire frequency with its multiple (5H).
Added additional examples to name
and freqstr
to clarify this
dt : datetime.datetime | ||
Timestamp to check intersections with frequency. | ||
|
||
Examples |
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.
Could we get an example where this is False as well. Think this might be useful.
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.
Good idea. Added an example which returns False
pandas/_libs/tslibs/offsets.pyx
Outdated
@@ -745,26 +822,96 @@ cdef class BaseOffset: | |||
def is_anchored(self) -> bool: | |||
# TODO: Does this make sense for the general case? It would help | |||
# if there were a canonical docstring for what is_anchored means. | |||
""" | |||
Return boolean whether the frequency is a unit frequency. |
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.
I don't understand this - but I don't use these functions frequently.
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.
Added a note here that unit
means (n=1)
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.
these all lgtm, didn't realise there were so many of these types of function actually. interesting :)
* Add examples to offsets * Finish examples for offsets * Finish examples for offsets * Undo API removals, fix failures * Address review
The goal is to eventually enable the
EX01
(all docstrings have examples), so adding simple examples to the public frequency classes and methods.