Skip to content

Period 29073 #29159

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 6 commits into from
Oct 23, 2019
Merged
Show file tree
Hide file tree
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
35 changes: 23 additions & 12 deletions pandas/_libs/tslibs/period.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -1709,14 +1709,14 @@ cdef class _Period:

def asfreq(self, freq, how='E'):
"""
Convert Period to desired frequency, either at the start or end of the
interval.
Convert Period to desired frequency, at the start or end of the interval.

Parameters
----------
freq : string
freq : str
The desired frequency.
how : {'E', 'S', 'end', 'start'}, default 'end'
Start or end of the timespan
Start or end of the timespan.

Returns
-------
Expand Down Expand Up @@ -1776,17 +1776,19 @@ cdef class _Period:

def to_timestamp(self, freq=None, how='start', tz=None):
"""
Return the Timestamp representation of the Period at the target
frequency at the specified end (how) of the Period.
Return the Timestamp representation of the Period.

Uses the target frequency specified at the part of the period specified
by `how`, which is either `Start` or `Finish`.

Parameters
----------
freq : string or DateOffset
freq : str or DateOffset
Target frequency. Default is 'D' if self.freq is week or
longer and 'S' otherwise
longer and 'S' otherwise.
how : str, default 'S' (start)
'S', 'E'. Can be aliased as case insensitive
'Start', 'Finish', 'Begin', 'End'
One of 'S', 'E'. Can be aliased as case insensitive
'Start', 'Finish', 'Begin', 'End'.

Returns
-------
Expand Down Expand Up @@ -2385,16 +2387,25 @@ class Period(_Period):
Parameters
----------
value : Period or str, default None
The time period represented (e.g., '4Q2005')
The time period represented (e.g., '4Q2005').
freq : str, default None
One of pandas period strings or corresponding objects
One of pandas period strings or corresponding objects.
ordinal : int, default None
The period offset from the gregorian proleptic epoch.
year : int, default None
Year value of the period.
month : int, default 1
Month value of the period.
quarter : int, default None
Quarter value of the period.
day : int, default 1
Day value of the period.
hour : int, default 0
Hour value of the period.
minute : int, default 0
Minute value of the period.
second : int, default 0
Second value of the period.
"""

def __new__(cls, value=None, freq=None, ordinal=None,
Expand Down
2 changes: 1 addition & 1 deletion pandas/core/dtypes/dtypes.py
Original file line number Diff line number Diff line change
Expand Up @@ -793,7 +793,7 @@ class PeriodDtype(PandasExtensionDtype):
Parameters
----------
freq : str or DateOffset
The frequency of this PeriodDtype
The frequency of this PeriodDtype.

Attributes
----------
Expand Down