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
- New Content published on w3resource:
- HTML-CSS Practical: Exercises, Practice, Solution
- Java Regular Expression: Exercises, Practice, Solution
- Scala Programming Exercises, Practice, Solution
- Python Itertools exercises
- Python Numpy exercises
- Python GeoPy Package exercises
- Python Pandas exercises
- Python nltk exercises
- Python BeautifulSoup exercises
- Form Template
- Composer - PHP Package Manager
- PHPUnit - PHP Testing
- Laravel - PHP Framework
- Angular - JavaScript Framework
- Vue - JavaScript Framework
- Jest - JavaScript Testing Framework