Skip to content

improve period constructor docs #47321

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 2 commits into from
Jun 15, 2022
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
12 changes: 10 additions & 2 deletions pandas/_libs/tslibs/period.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -2483,9 +2483,11 @@ class Period(_Period):
Parameters
----------
value : Period or str, default None
The time period represented (e.g., '4Q2005').
The time period represented (e.g., '4Q2005'). This represents neither
the start or the end of the period, but rather the entire period itself.
freq : str, default None
One of pandas period strings or corresponding objects.
One of pandas period strings or corresponding objects. Accepted
strings are listed in the :ref:`offset alias section <timeseries.offset_aliases>` in the user docs.
ordinal : int, default None
The period offset from the proleptic Gregorian epoch.
year : int, default None
Expand All @@ -2502,6 +2504,12 @@ class Period(_Period):
Minute value of the period.
second : int, default 0
Second value of the period.

Examples
--------
>>> period = pd.Period('2012-1-1', freq='D')
>>> period
Period('2012-01-01', 'D')
"""

def __new__(cls, value=None, freq=None, ordinal=None,
Expand Down