- Python Basic Tutorial
- Python - Home
- Python - Overview
- Python - Environment Setup
- Python - Basic Syntax
- Python - Comments
- Python - Variables
- Python - Data Types
- Python - Operators
- Python - Decision Making
- Python - Loops
- Python - Numbers
- Python - Strings
- Python - Lists
- Python - Tuples
- Python - Dictionary
- Python - Date & Time
- Python - Functions
- Python - Modules
- Python - Files I/O
- Python - Exceptions

# Python Pandas IntervalIndex - Check if Intervals that only have an open endpoint in common overlap or not

To check if Intervals that only have an open endpoint in common overlap or not, use the **IntervalIndex.is_overlapping** property.

At first, import the required libraries −

import pandas as pd

Create IntervalIndex. The intervals are closed on the left-side since the "closed" parameter is set "left" −

interval = pd.interval_range(0, 8, closed='left')

Display the interval −

print("IntervalIndex...\n",interval)

Check if the Intervals that only have an open endpoint in common overlap or not −

print("\nDoes the Intervals that have an open endpoint overlap?\n",interval.is_overlapping)

## Example

Following is the code −

import pandas as pd # Create IntervalIndex # The intervals are closed on the left-side since the "closed" parameter is set "left" interval = pd.interval_range(0, 8, closed='left') # Display the interval print("IntervalIndex...\n",interval) # Display the interval length print("\nIntervalIndex length...\n",interval.length) # Check if the Intervals that only have an open endpoint in common overlap or not print("\nDoes the Intervals that have an open endpoint overlap?\n",interval.is_overlapping)

## Output

This will produce the following output −

IntervalIndex... IntervalIndex([[0, 1), [1, 2), [2, 3), [3, 4), [4, 5), [5, 6), [6, 7), [7, 8)], dtype='interval[int64, left]') IntervalIndex length... Int64Index([1, 1, 1, 1, 1, 1, 1, 1], dtype='int64') Does the Intervals that have an open endpoint overlap? False

- Related Articles
- Python Pandas IntervalArray - Check Intervals that only have an open endpoint in common overlap or not
- Python Pandas IntervalIndex - Check if Intervals that share closed endpoints overlap
- Python Pandas - Check whether two Interval objects that share an open endpoint overlap
- Python Pandas IntervalArray - Check Intervals that share closed endpoints overlap or not
- Python Pandas IntervalIndex - Check if an interval that contains points is empty or not
- Python Pandas - Check if the IntervalIndex has overlapping intervals
- Python Pandas IntervalIndex - Check if an interval with missing values is empty or not
- Python Pandas - Check elementwise if the Intervals in the IntervalIndex contain the value
- Check elementwise if the Intervals in the IntervalIndex contain the value in Python Pandas
- Python Pandas - Check whether the IntervalIndex intervals are closed on the left-side, right-side, both or neither
- Check if any two intervals overlap among a given set of intervals in C++
- Python Pandas - Create an IntervalIndex
- Python Pandas - Check if an interval set as open is empty
- Python Pandas - Check whether two Interval objects that share closed endpoints overlap
- Python Pandas - Check whether two Interval objects overlap

Advertisements