Skip to main content
`Ctrl`+`K`

# pandas.IntervalIndex.is_non_overlapping_monotonic

IntervalIndex.is_non_overlapping_monotonic

  Return a boolean whether the IntervalArray is non-overlapping and monotonic.

  Non-overlapping means (no Intervals share points), and monotonic means either monotonic increasing or monotonic decreasing.

  Examples

  For arrays:

      >>> interv_arr = pd.arrays.IntervalArray([pd.Interval(0, 1), pd.Interval(1, 5)])
      >>> interv_arr
      <IntervalArray>
      [(0, 1], (1, 5]]
      Length: 2, dtype: interval[int64, right]
      >>> interv_arr.is_non_overlapping_monotonic
      True

      >>> interv_arr = pd.arrays.IntervalArray([pd.Interval(0, 1),
      ...                                       pd.Interval(-1, 0.1)])
      >>> interv_arr
      <IntervalArray>
      [(0.0, 1.0], (-1.0, 0.1]]
      Length: 2, dtype: interval[float64, right]
      >>> interv_arr.is_non_overlapping_monotonic
      False

  For Interval Index:

      >>> interv_idx = pd.interval_range(start=0, end=2)
      >>> interv_idx
      IntervalIndex([(0, 1], (1, 2]], dtype='interval[int64, right]')
      >>> interv_idx.is_non_overlapping_monotonic
      True

      >>> interv_idx = pd.interval_range(start=0, end=2, closed='both')
      >>> interv_idx
      IntervalIndex([[0, 1], [1, 2]], dtype='interval[int64, both]')
      >>> interv_idx.is_non_overlapping_monotonic
      False