

- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Python Pandas - Check if an Interval is closed on the left side
To check if an Interval is closed on the left side, use the interval.closed_left property. At first, import the required libraries −
import pandas as pd
Interval set using the "closed" parameter with value "left" i.e. [0, 5) is described by 0 <= x < 5 when closed='left'
interval = pd.Interval(left=0, right=20, closed='left')
Display the interval
print("Interval...\n",interval)
Check whether the interval is closed on the left-side
print("\nChecking whether the Interval is closed on the left...\n", interval.closed_left)
Example
Following is the code
import pandas as pd # Interval set using the "closed" parameter with value "left" # i.e. [0, 5) is described by 0 <= x < 5 when closed='left' interval = pd.Interval(left=0, right=20, closed='left') # display the interval print("Interval...\n",interval) # display the interval length print("\nInterval length...\n",interval.length) # check whether the interval is closed on the left-side print("\nChecking whether the Interval is closed on the left...\n", interval.closed_left)
Output
This will produce the following code
Interval... [0, 20) Interval length... 20 Checking whether the Interval is closed on the left... True
- Related Questions & Answers
- Python Pandas - Check if an interval is empty if closed from the left side
- Python Pandas - Check if an Interval is closed on the right side
- Python Pandas - Check if the interval is open on the left side
- Python Pandas - Check whether the interval is closed on the left-side, right-side, both or neither
- Python Pandas - Check if the interval is open on the right side
- Python Pandas - Check if an interval is empty if closed from the both sides
- Python Pandas - Check whether the IntervalIndex intervals are closed on the left-side, right-side, both or neither
- Python Pandas - Check whether the intervals in IntervalArray are closed on the left-side, right-side, both or neither
- Python Pandas - Return an IntervalArray identical to the current one but closed on the left side
- Python Pandas - Check if an interval is empty
- Python Pandas - Create an IntervalArray from an array of splits and check the intervals are closed on the left or right-side, both or neither
- Python Pandas - Check if an interval set as open is empty
- Python Pandas - Check if an element belongs to an Interval
- Python Pandas - Check if the Pandas Index holds Interval objects
- Python Pandas - Return an IntervalArray identical to the current one but closed on the specified side
Advertisements