Skip to content

Commit 5e66789

Browse files
IHackPyTomAugspurger
authored andcommitted
DOC : Update the pandas.Period.hour docstring (#20312)
1 parent 44300f9 commit 5e66789

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

pandas/_libs/tslibs/period.pyx

+25
Original file line numberDiff line numberDiff line change
@@ -1241,6 +1241,31 @@ cdef class _Period(object):
12411241

12421242
@property
12431243
def hour(self):
1244+
"""
1245+
Get the hour of the day component of the Period.
1246+
1247+
Returns
1248+
-------
1249+
int
1250+
The hour as an integer, between 0 and 23.
1251+
1252+
See Also
1253+
--------
1254+
Period.second : Get the second component of the Period.
1255+
Period.minute : Get the minute component of the Period.
1256+
1257+
Examples
1258+
--------
1259+
>>> p = pd.Period("2018-03-11 13:03:12.050000")
1260+
>>> p.hour
1261+
13
1262+
1263+
Period longer than a day
1264+
1265+
>>> p = pd.Period("2018-03-11", freq="M")
1266+
>>> p.hour
1267+
0
1268+
"""
12441269
base, mult = get_freq_code(self.freq)
12451270
return phour(self.ordinal, base)
12461271

0 commit comments

Comments
 (0)