-
-
Notifications
You must be signed in to change notification settings - Fork 18.6k
DOC: update the Period.dayofweek attribute docstring #20280
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
Changes from 1 commit
eef375c
952be06
3e25a7e
8072b21
de15589
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1246,6 +1246,37 @@ cdef class _Period(object): | |
|
||
@property | ||
def dayofweek(self): | ||
""" | ||
Return the day of the week. | ||
|
||
This attribute returns the day of the week on which the particular | ||
date occurs with Monady=0, Sunday=6. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Monday |
||
|
||
Returns | ||
------- | ||
Int:Range of 0 to 6 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not following the style guide, see https://python-sprints.github.io/pandas/guide/pandas_docstring.html#section-4-returns-or-yields |
||
|
||
See also | ||
-------- | ||
Period.dayofyear | ||
Return the day of year. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you do this in form of |
||
Period.daysinmonth | ||
Return the days in that month. | ||
|
||
Examples | ||
-------- | ||
>>> p=pd.Period('2012-1-1 19:00', freq='H') | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
>>> p | ||
Period('2012-01-01 19:00', 'H') | ||
>>> p.dayofweek | ||
6 | ||
|
||
>>> q=pd.Period('2013-1-9 11:00', freq='H') | ||
>>> q | ||
Period('2013-01-09 11:00', 'H') | ||
>>> q.dayofweek | ||
2 | ||
""" | ||
base, mult = get_freq_code(self.freq) | ||
return pweekday(self.ordinal, base) | ||
|
||
|
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.
If I'm not mistaken, this will return the day of the week on which the particular starting date for the given period occurs. I think this is important to mention, because at first I was confused thinking "how a period of one month can have a day of the week?".
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.
Yes, we have this discussion in another PR as well (https://github.com/pandas-dev/pandas/pull/20277/files#r173651389). Only, it is not necessarily the starting date, it depends on the
freq
.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.
Issue is here: #20324.