pandas.period_range
pandas 3.1.1 · General functions · function
Generate consecutive periods such as months or quarters and return a PeriodIndex.
Call syntax
pd.period_range(start=None, end=None, periods=None, freq=None, name=None)Run the example
Edit the example and select Run Python to see the result.
Parameters
| Parameter | Requirement | Accepted values and behavior |
|---|---|---|
start |
Optional Positional or keyword Default None |
str, datetime, date, pandas.Timestamp, or period-like Supply the start point of a range, slice, or calculation. |
end |
Optional Positional or keyword Default None |
str, datetime, date, pandas.Timestamp, or period-like Supply the endpoint of the range or calculation. |
periods |
Optional Positional or keyword Default None |
int Set a count of generated observations or the number of steps to shift or compare. |
freq |
Optional Positional or keyword Default None |
str or DateOffset Specify the frequency or offset, such as "D" for a day or "MS" for a calendar month start. |
name |
Optional Positional or keyword Default None |
str Set a name or identify the named object used by the operation. |
Returns
PeriodIndex