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
-
Economics & Finance
Selected Reading
Python Pandas - Get the length of the Interval
To get the length of the Interval, use the interval.length property. At first, import the required libraries −
import pandas as pd
Open interval set using the "closed" parameter with value "neither". An open interval (in mathematics denoted by square brackets) does not contains its endpoints, i.e. the open interval [0, 5] is characterized by the conditions 0
interval = pd.Interval(5, 20, closed='neither')
Display the interval length
print("\nInterval length...\n",interval.length)
Example
Following is the code
import pandas as pd # Open interval set using the "closed" parameter with value "neither" # An open interval (in mathematics denoted by square brackets) does not contains its endpoints, # i.e. the open interval [0, 5] is characterized by the conditions 0Output
This will produce the following code
Interval... (5, 20) The left bound for the Interval... 5 The right bound for the Interval... 20 Interval length... 15
Advertisements
