pandas 1.4.2

NotesParametersReturnsBackRef
period_range(start=None, end=None, periods: 'int | None' = None, freq=None, name=None) -> 'PeriodIndex'

The day (calendar) is the default frequency.

Notes

Of the three parameters: start , end , and periods , exactly two must be specified.

To learn more about the frequency strings, please see :None:None:`this link <https://pandas.pydata.org/pandas-docs/stable/user_guide/timeseries.html#offset-aliases>`.

Parameters

start : str or period-like, default None

Left bound for generating periods.

end : str or period-like, default None

Right bound for generating periods.

periods : int, default None

Number of periods to generate.

freq : str or DateOffset, optional

Frequency alias. By default the freq is taken from :None:None:`start` or :None:None:`end` if those are Period objects. Otherwise, the default is "D" for daily frequency.

name : str, default None

Name of the resulting PeriodIndex.

Returns

PeriodIndex

Return a fixed frequency PeriodIndex.

Examples

This example is valid syntax, but we were not able to check execution
>>> pd.period_range(start='2017-01-01', end='2018-01-01', freq='M')
PeriodIndex(['2017-01', '2017-02', '2017-03', '2017-04', '2017-05', '2017-06',
         '2017-07', '2017-08', '2017-09', '2017-10', '2017-11', '2017-12',
         '2018-01'],
        dtype='period[M]')

If start or end are Period objects, they will be used as anchor endpoints for a PeriodIndex with frequency matching that of the period_range constructor.

This example is valid syntax, but we were not able to check execution
>>> pd.period_range(start=pd.Period('2017Q1', freq='Q'),
...  end=pd.Period('2017Q2', freq='Q'), freq='M') PeriodIndex(['2017-03', '2017-04', '2017-05', '2017-06'], dtype='period[M]')
See :

Back References

The following pages refer to to this document either explicitly or contain code examples using this.

pandas.core.indexes.period.PeriodIndex pandas.core.indexes.datetimes.date_range pandas.core.arrays.period.PeriodArray

Local connectivity graph

Hover to see nodes names; edges to Self not shown, Caped at 50 nodes.

Using a canvas is more power efficient and can get hundred of nodes ; but does not allow hyperlinks; , arrows or text (beyond on hover)

SVG is more flexible but power hungry; and does not scale well to 50 + nodes.

All aboves nodes referred to, (or are referred from) current nodes; Edges from Self to other have been omitted (or all nodes would be connected to the central node "self" which is not useful). Nodes are colored by the library they belong to, and scaled with the number of references pointing them


File: /pandas/core/indexes/period.py#502
type: <class 'function'>
Commit: