Skip to content

Commit 39c69da

Browse files
authored
DOC: pd.Period and pd.period_range should document that they accept datetime, date and pd.Timestamp (#53632)
* Update docstrings for pandas.Period and period_range * Fix Period docstring comment * Fix Period value docstring
1 parent 33199e1 commit 39c69da

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

pandas/_libs/tslibs/period.pyx

+1
Original file line numberDiff line numberDiff line change
@@ -2675,6 +2675,7 @@ class Period(_Period):
26752675
One of pandas period strings or corresponding objects. Accepted
26762676
strings are listed in the
26772677
:ref:`offset alias section <timeseries.offset_aliases>` in the user docs.
2678+
If value is datetime, freq is required.
26782679
ordinal : int, default None
26792680
The period offset from the proleptic Gregorian epoch.
26802681
year : int, default None

pandas/core/indexes/period.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -478,7 +478,7 @@ def period_range(
478478
----------
479479
start : str, datetime, date, pandas.Timestamp, or period-like, default None
480480
Left bound for generating periods.
481-
end : str or period-like, default None
481+
end : str, datetime, date, pandas.Timestamp, or period-like, default None
482482
Right bound for generating periods.
483483
periods : int, default None
484484
Number of periods to generate.

0 commit comments

Comments
 (0)