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 empty
To check if an Interval is empty, use the interval.is_empty property. At first, import the required libraries −
import pandas as pd
Create an interval
interval = pd.Interval(0, 0, closed='right')
Display the interval
print("Interval...\n",interval)
Check whether interval is empty
print("\nIs Interval empty? \n",interval.is_empty)
Example
Following is the code
import pandas as pd
# Create an interval
interval = pd.Interval(0, 0, closed='right')
# display the interval
print("Interval...\n",interval)
# display the interval length
print("\nInterval length...\n",interval.length)
# check whether interval is empty
print("\nIs Interval empty? \n",interval.is_empty)
Output
This will produce the following code
Interval... (0, 0] Interval length... 0 Is Interval empty? True
Advertisements
