Skip to content

DOC : Update the pandas.Period.hour docstring #20312

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 3 commits into from
Mar 12, 2018
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
25 changes: 25 additions & 0 deletions pandas/_libs/tslibs/period.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -1241,6 +1241,31 @@ cdef class _Period(object):

@property
def hour(self):
"""
Get the hour of the day component of the Period.

Returns
-------
int
The hour as an integer, between 0 and 23.

See Also
--------
Period.second : Get the second component of the Period.
Period.minute : Get the minute component of the Period.

Examples
--------
>>> p = pd.Period("2018-03-11 13:03:12.050000")
>>> p.hour
13

Period longer than a day

>>> p = pd.Period("2018-03-11", freq="M")
>>> p.hour
0
"""
base, mult = get_freq_code(self.freq)
return phour(self.ordinal, base)

Expand Down