Skip to content

Commit 6983800

Browse files
HughKelleyBlake Hawkins
authored and
Blake Hawkins
committed
Period 29073 (pandas-dev#29159)
1 parent 091bb06 commit 6983800

File tree

2 files changed

+24
-13
lines changed

2 files changed

+24
-13
lines changed

pandas/_libs/tslibs/period.pyx

+23-12
Original file line numberDiff line numberDiff line change
@@ -1709,14 +1709,14 @@ cdef class _Period:
17091709

17101710
def asfreq(self, freq, how='E'):
17111711
"""
1712-
Convert Period to desired frequency, either at the start or end of the
1713-
interval.
1712+
Convert Period to desired frequency, at the start or end of the interval.
17141713
17151714
Parameters
17161715
----------
1717-
freq : string
1716+
freq : str
1717+
The desired frequency.
17181718
how : {'E', 'S', 'end', 'start'}, default 'end'
1719-
Start or end of the timespan
1719+
Start or end of the timespan.
17201720
17211721
Returns
17221722
-------
@@ -1776,17 +1776,19 @@ cdef class _Period:
17761776

17771777
def to_timestamp(self, freq=None, how='start', tz=None):
17781778
"""
1779-
Return the Timestamp representation of the Period at the target
1780-
frequency at the specified end (how) of the Period.
1779+
Return the Timestamp representation of the Period.
1780+
1781+
Uses the target frequency specified at the part of the period specified
1782+
by `how`, which is either `Start` or `Finish`.
17811783
17821784
Parameters
17831785
----------
1784-
freq : string or DateOffset
1786+
freq : str or DateOffset
17851787
Target frequency. Default is 'D' if self.freq is week or
1786-
longer and 'S' otherwise
1788+
longer and 'S' otherwise.
17871789
how : str, default 'S' (start)
1788-
'S', 'E'. Can be aliased as case insensitive
1789-
'Start', 'Finish', 'Begin', 'End'
1790+
One of 'S', 'E'. Can be aliased as case insensitive
1791+
'Start', 'Finish', 'Begin', 'End'.
17901792
17911793
Returns
17921794
-------
@@ -2385,16 +2387,25 @@ class Period(_Period):
23852387
Parameters
23862388
----------
23872389
value : Period or str, default None
2388-
The time period represented (e.g., '4Q2005')
2390+
The time period represented (e.g., '4Q2005').
23892391
freq : str, default None
2390-
One of pandas period strings or corresponding objects
2392+
One of pandas period strings or corresponding objects.
2393+
ordinal : int, default None
2394+
The period offset from the gregorian proleptic epoch.
23912395
year : int, default None
2396+
Year value of the period.
23922397
month : int, default 1
2398+
Month value of the period.
23932399
quarter : int, default None
2400+
Quarter value of the period.
23942401
day : int, default 1
2402+
Day value of the period.
23952403
hour : int, default 0
2404+
Hour value of the period.
23962405
minute : int, default 0
2406+
Minute value of the period.
23972407
second : int, default 0
2408+
Second value of the period.
23982409
"""
23992410

24002411
def __new__(cls, value=None, freq=None, ordinal=None,

pandas/core/dtypes/dtypes.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -793,7 +793,7 @@ class PeriodDtype(PandasExtensionDtype):
793793
Parameters
794794
----------
795795
freq : str or DateOffset
796-
The frequency of this PeriodDtype
796+
The frequency of this PeriodDtype.
797797
798798
Attributes
799799
----------

0 commit comments

Comments
 (0)