w3resource

Pandas: Data Manipulation - interval_range() function

interval_range() function

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

Syntax:

pandas.interval_range(start=None, end=None, periods=None, freq=None, name=None, closed='right')

Return a fixed frequency IntervalIndex

Parameters:

Name Description Type Default Value Required / Optional
start  Left bound for generating intervals numeric or datetime-like None Required
end  Right bound for generating intervals numeric or datetime-like None Required
periods Number of periods to generate integer None Required
freq The length of each interval. Must be consistent with the type of start and end, e.g. 2 for numeric, or ‘5H’ for datetime-like. Default is 1 for numeric and ‘D’ for datetime-like. numeric, string, or DateOffset None Required
name Name of the resulting IntervalIndex string None Required
closed  Whether the intervals are closed on the left-side, right-side, both or neither. {‘left’, ‘right’, ‘both’, ‘neither’} ‘right’ Required

Returns: rng- IntervalIndex

Notes:

Of the four parameters start, end, periods, and freq, exactly three must be specified. If freq is omitted, the resulting IntervalIndex will have periods linearly spaced elements between start and end, inclusively.

Example:


Download the Pandas DataFrame Notebooks from here.

Previous: timedelta_range() function
Next: eval() function



Become a Patron!

Follow us on Facebook and Twitter for latest update.

It will be nice if you may share this link in any developer community or anywhere else, from where other developers may find this content. Thanks.

https://www.w3resource.com/pandas/interval_range.php