Participer au site avec un Tip
Rechercher
 

Améliorations / Corrections

Vous avez des améliorations (ou des corrections) à proposer pour ce document : je vous remerçie par avance de m'en faire part, cela m'aide à améliorer le site.

Emplacement :

Description des améliorations :

Classe « IntervalIndex »

Méthode pandas.IntervalIndex.from_arrays

Signature de la méthode from_arrays

def from_arrays(left, right, closed: str = 'right', name=None, copy: bool = False, dtype=None) 

Description

from_arrays.__doc__

Construct from two arrays defining the left and right bounds.

Parameters
----------
left : array-like (1-dimensional)
    Left bounds for each interval.
right : array-like (1-dimensional)
    Right bounds for each interval.
closed : {'left', 'right', 'both', 'neither'}, default 'right'
    Whether the intervals are closed on the left-side, right-side, both
    or neither.
copy : bool, default False
    Copy the data.
dtype : dtype, optional
    If None, dtype will be inferred.

Returns
-------
IntervalIndex

Raises
------
ValueError
    When a value is missing in only one of `left` or `right`.
    When a value in `left` is greater than the corresponding value
    in `right`.

See Also
--------
interval_range : Function to create a fixed frequency IntervalIndex.
IntervalIndex.from_breaks : Construct an IntervalIndex from an array of
    splits.
IntervalIndex.from_tuples : Construct an IntervalIndex from an
    array-like of tuples.

Notes
-----
Each element of `left` must be less than or equal to the `right`
element at the same position. If an element is missing, it must be
missing in both `left` and `right`. A TypeError is raised when
using an unsupported type for `left` or `right`. At the moment,
'category', 'object', and 'string' subtypes are not supported.

Examples
--------
>>> pd.IntervalIndex.from_arrays([0, 1, 2], [1, 2, 3])
IntervalIndex([(0, 1], (1, 2], (2, 3]],
              closed='right',
              dtype='interval[int64]')