IntervalIndex ============= .. currentmodule:: pandasCore .. class:: IntervalIndex Immutable index backed by interval data. Example ------- .. code-block:: python import pandasCore as pd # Create IntervalIndex idx = pd.IntervalIndex([1, 2, 3], name='my_index') print(len(idx)) # 3 Attributes ---------- .. list-table:: :widths: 25 60 15 :header-rows: 1 * - Attribute - Description - Example * - :attr:`~IntervalIndex.closed` - String describing the inclusive side(s) of the intervals - * - :attr:`~IntervalIndex.dtype` - Return the dtype object of the underlying data - * - :attr:`~IntervalIndex.empty` - Indicator whether IntervalIndex is empty - * - :attr:`~IntervalIndex.has_duplicates` - Return if the index has duplicate values - * - :attr:`~IntervalIndex.is_empty` - Indicates if an interval is empty (left == right and not both-closed) - * - :attr:`~IntervalIndex.is_monotonic_decreasing` - Return if the index is monotonic decreasing - * - :attr:`~IntervalIndex.is_monotonic_increasing` - Return if the index is monotonic increasing - * - :attr:`~IntervalIndex.is_non_overlapping_monotonic` - Return True if intervals are non-overlapping and monotonically sorted - * - :attr:`~IntervalIndex.is_overlapping` - Return True if any intervals overlap - * - :attr:`~IntervalIndex.is_unique` - Return if the index has unique values - * - :attr:`~IntervalIndex.left` - Return the left bounds of the intervals - * - :attr:`~IntervalIndex.length` - Return the length of each interval - * - :attr:`~IntervalIndex.mid` - Return the midpoint of each interval - * - :attr:`~IntervalIndex.name` - Return the name of the IntervalIndex - * - :attr:`~IntervalIndex.ndim` - Number of dimensions of the underlying data - * - :attr:`~IntervalIndex.nlevels` - Number of levels in this index - * - :attr:`~IntervalIndex.right` - Return the right bounds of the intervals - * - :attr:`~IntervalIndex.shape` - Return a tuple of the shape of the underlying data - * - :attr:`~IntervalIndex.size` - Return the number of elements in the IntervalIndex - * - :attr:`~IntervalIndex.str` - Vectorized string functions for Index. - :ref:`View ` Construction ------------ .. list-table:: :widths: 25 60 15 :header-rows: 1 * - Method - Description - Example * - :meth:`~IntervalIndex.__init__` ``(*args, **kwargs) | () | (data: collections.abc.Sequence[tuple[typing.SupportsFloat, typing.SupportsFloat]], closed: object = None, dtype: object = None, copy: bool = False, name: object = None, verify_integrity: bool = True)`` - Create an empty IntervalIndex - :ref:`View ` Indexing / Selection -------------------- .. list-table:: :widths: 25 60 15 :header-rows: 1 * - Method - Description - Example * - :meth:`~IntervalIndex.__getitem__` ``(arg0: typing.SupportsInt)`` - - * - :meth:`~IntervalIndex.take` ``(indices: collections.abc.Sequence[typing.SupportsInt], axis: typing.SupportsInt = 0, allow_fill: bool = True, fill_value: object = None, **kwargs)`` - Return new IntervalIndex with elements at specified positions - * - :meth:`~IntervalIndex.where` ``(cond: object, other: object = None)`` - Replace values where the condition is False. - Data Manipulation ----------------- .. list-table:: :widths: 25 60 15 :header-rows: 1 * - Method - Description - Example * - :meth:`~IntervalIndex.drop` ``(labels: object, errors: str = 'raise')`` - Make new Index with passed list of labels deleted - * - :meth:`~IntervalIndex.droplevel` ``(level: typing.SupportsInt = 0)`` - Return index with requested level(s) removed. - * - :meth:`~IntervalIndex.insert` ``(loc: typing.SupportsInt, item: object)`` - Make new IntervalIndex inserting new item at location - * - :meth:`~IntervalIndex.reindex` ``(target: pandasCore.IntervalIndex, method: object = None, level: object = None, limit: object = None, tolerance: object = None)`` - Conform Index to new index with optional filling logic - * - :meth:`~IntervalIndex.rename` ``(name: object, *, inplace: bool = False)`` - Alter IntervalIndex name. - * - :meth:`~IntervalIndex.set_names` ``(names: object, *, level: object = None, inplace: bool = False)`` - Set IntervalIndex name - Missing Data ------------ .. list-table:: :widths: 25 60 15 :header-rows: 1 * - Method - Description - Example * - :meth:`~IntervalIndex.dropna` ``(how: str = 'any')`` - Return IntervalIndex without NA values - * - :meth:`~IntervalIndex.fillna` ``(value: object = None, downcast: object = None)`` - Fill NA/NaN values with the specified value - * - :meth:`~IntervalIndex.isna` ``()`` - Detect missing values - * - :meth:`~IntervalIndex.isnull` ``()`` - Detect missing values (alias for isna) - * - :meth:`~IntervalIndex.notna` ``()`` - Detect existing (non-missing) values - * - :meth:`~IntervalIndex.notnull` ``()`` - Detect existing (non-missing) values (alias for notna) - Statistics ---------- .. list-table:: :widths: 25 60 15 :header-rows: 1 * - Method - Description - Example * - :meth:`~IntervalIndex.max` ``(axis: object = None, skipna: bool = True, *args, **kwargs)`` - Return the maximum interval (by left bound) - * - :meth:`~IntervalIndex.min` ``(axis: object = None, skipna: bool = True, *args, **kwargs)`` - Return the minimum interval (by left bound) - * - :meth:`~IntervalIndex.nunique` ``(dropna: bool = True)`` - Return number of unique elements in the index - * - :meth:`~IntervalIndex.value_counts` ``(normalize: bool = False, sort: bool = True, ascending: bool = False, bins: object = None, dropna: bool = True)`` - Return a dict containing counts of unique values - Aggregation ----------- .. list-table:: :widths: 25 60 15 :header-rows: 1 * - Method - Description - Example * - :meth:`~IntervalIndex.groupby` ``(values: collections.abc.Sequence[typing.SupportsInt])`` - Group the index labels by a given array of values - * - :meth:`~IntervalIndex.map` ``(mapper: object, na_action: object = None)`` - Map values using an input mapping or function - Comparison ---------- .. list-table:: :widths: 25 60 15 :header-rows: 1 * - Method - Description - Example * - :meth:`~IntervalIndex.__eq__` ``(self, value, /)`` - Return self==value. - * - :meth:`~IntervalIndex.__ge__` ``(self, value, /)`` - Return self>=value. - * - :meth:`~IntervalIndex.__gt__` ``(self, value, /)`` - Return self>value. - * - :meth:`~IntervalIndex.__le__` ``(self, value, /)`` - Return self<=value. - * - :meth:`~IntervalIndex.__lt__` ``(self, value, /)`` - Return self