Skip to content

Commit 7fb7c19

Browse files
committed
DOC: docstring, closes pandas-dev#23475
1 parent 6258397 commit 7fb7c19

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

pandas/_libs/tslibs/period.pyx

+10-1
Original file line numberDiff line numberDiff line change
@@ -1529,7 +1529,16 @@ cdef class _Period:
15291529
self._dtype = PeriodPseudoDtype(freq._period_dtype_code)
15301530

15311531
@classmethod
1532-
def _maybe_convert_freq(cls, object freq):
1532+
def _maybe_convert_freq(cls, object freq) -> BaseOffset:
1533+
"""
1534+
Internally we allow integer and tuple representations (for now) that
1535+
are not recognized by to_offset, so we convert them here. Also, a
1536+
Period's freq attribute must have `freq.n > 0`, which we check for here.
1537+
1538+
Returns
1539+
-------
1540+
DateOffset
1541+
"""
15331542
if isinstance(freq, (int, tuple)):
15341543
code, stride = get_freq_code(freq)
15351544
freq = get_freq_str(code, stride)

0 commit comments

Comments
 (0)