Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
Selected Reading
Python Pandas - Check if an Interval is closed on the right side
To check if an Interval is closed on the left side, use the interval.closed_right property. At first, import the required libraries −
import pandas as pd
Interval set using the "closed" parameter with value "right" i.e. [0, 5) is described by 0
interval = pd.Interval(left=0, right=20, closed='right')
Display the interval
print("Interval...\n",interval)
Check whether the interval is closed on the right-side
print("\nChecking whether the Interval is closed on the right...\n", interval.closed_right)
Example
Following is the code
import pandas as pd # Interval set using the "closed" parameter with value "right" # i.e. [0, 5) is described by 0Output
This will produce the following code
Interval... (0, 20] Interval length... 20 Checking whether the Interval is closed on the right... True
Advertisements
