w3resource

Pandas: Data Manipulation - period_range() function

period_range() function

The period_range() function is used to concatenate pandas objects along a particular axis with optional set logic along the other axes.

Syntax:

pandas.period_range(start=None, end=None, periods=None, freq=None, name=None)

Parameters:

Name Description Type / Default Value Required / Optional
start  Left bound for generating periods string or period-like
Default Value: None
Required
end  Right bound for generating periods string or period-like
Default Value: None
Required
periods Number of periods to generate. integer
Default Value: None
Required
freq Frequency alias. By default the freq is taken from start or end if those are Period objects. Otherwise, the default is "D" for daily frequency. string or DateOffset Optional
name  Name of the resulting PeriodIndex string
Default Value: None
Required

Returns: prng - PeriodIndex

Notes

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

Example:


Download the Pandas DataFrame Notebooks from here.

Previous: bdate_range() function
Next: timedelta_range() function



Follow us on Facebook and Twitter for latest update.