Skip to content

DOC : Update the pandas.Period.week docstring #20331

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

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions pandas/_libs/tslibs/period.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -1305,6 +1305,32 @@ cdef class _Period(object):

@property
def week(self):
"""
Get the week of the year on the given Period.

Returns
-------
int

See Also
--------
Period.dayofweek : Get the day component of the Period.
Period.weekday : Get the day component of the Period.

Examples
--------
>>> p = pd.Period("2018-03-11", "H")
>>> p.week
10

>>> p = pd.Period("2018-02-01", "D")
>>> p.week
5

>>> p = pd.Period("2018-01-06", "D")
>>> p.week
1
"""
return self.weekofyear

@property
Expand Down