Skip to main content
`Ctrl`+`K`

# pandas.Interval.is_empty

Interval.is_empty

  Indicates if an interval is empty, meaning it contains no points.

  An interval is considered empty if its left and right endpoints are equal, and it is not closed on both sides. This means that the interval does not include any real points. In the case of an `pandas.arrays.IntervalArray` or `IntervalIndex`, the property returns a boolean array indicating the emptiness of each interval.

  Returns:
    bool or ndarray

      A boolean indicating if a scalar `Interval` is empty, or a boolean `ndarray` positionally indicating if an `Interval` in an `IntervalArray` or `IntervalIndex` is empty.

  See also

  `Interval.length`

    Return the length of the Interval.

  Examples

  An `Interval` that contains points is not empty:

      >>> pd.Interval(0, 1, closed='right').is_empty
      False

  An `Interval` that does not contain any points is empty:

      >>> pd.Interval(0, 0, closed='right').is_empty
      True
      >>> pd.Interval(0, 0, closed='left').is_empty
      True
      >>> pd.Interval(0, 0, closed='neither').is_empty
      True

  An `Interval` that contains a single point is not empty:

      >>> pd.Interval(0, 0, closed='both').is_empty
      False

  An `IntervalArray` or `IntervalIndex` returns a boolean `ndarray` positionally indicating if an `Interval` is empty:

      >>> ivs = [pd.Interval(0, 0, closed='neither'),
      ...        pd.Interval(1, 2, closed='neither')]
      >>> pd.arrays.IntervalArray(ivs).is_empty
      array([ True, False])

  Missing values are not considered empty:

      >>> ivs = [pd.Interval(0, 0, closed='neither'), np.nan]
      >>> pd.IntervalIndex(ivs).is_empty
      array([ True, False])