

- 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 - Get the right bound for the IntervalIndex
To get the right bound for the IntervalIndex, use the interval.right property in Pandas. At first, import the required libraries −
import pandas as pd
Create IntervalIndex −
interval = pd.IntervalIndex.from_arrays([5, 10, 15], [15, 20, 25])
Display the interval −
print("IntervalIndex...\n",interval)
Get the right bound −
print("\nThe right bound for the IntervalIndex...\n",interval.right)
Example
Following is the code −
import pandas as pd # Create IntervalIndex interval = pd.IntervalIndex.from_arrays([5, 10, 15], [15, 20, 25]) # Display the interval print("IntervalIndex...\n",interval) # Display the interval length print("\nIntervalIndex length...\n",interval.length) # Check whether the IntervalIndex is closed on the left-side, right-side, both or neither print("\nChecking for the type of IntervalIndex...\n",interval.closed) # Get the right bound print("\nThe right bound for the IntervalIndex...\n",interval.right)
Output
This will produce the following output −
IntervalIndex... IntervalIndex([(5, 15], (10, 20], (15, 25]], dtype='interval[int64, right]') IntervalIndex length... Int64Index([10, 10, 10], dtype='int64') Checking for the type of IntervalIndex... right The right bound for the IntervalIndex... Int64Index([15, 20, 25], dtype='int64')
- Related Questions & Answers
- Python Pandas - Get the left bound for the IntervalIndex
- Python Pandas - Get the right bound for the interval
- Python Pandas - Get the left bound for the interval
- Python Pandas - Get the midpoint from the IntervalIndex
- Python Pandas - Get the length from the IntervalIndex
- Python Pandas IntervalIndex - Get integer location for requested label
- Python Pandas - Calculate the right slice bound that corresponds to given label
- Python Pandas IntervalIndex - Return an ndarray of tuples of the form (left, right)
- Python Pandas - Create an IntervalIndex
- Python Pandas - Check if the IntervalIndex has overlapping intervals
- Python Pandas - Check whether the IntervalIndex intervals are closed on the left-side, right-side, both or neither
- Python Pandas - Check elementwise if the Intervals in the IntervalIndex contain the value
- Python Pandas - Get the frequency for the given Period object
- Check elementwise if the Intervals in the IntervalIndex contain the value in Python Pandas
- Python Pandas IntervalIndex - Get the locations of all the relevant interval if a label is in several intervals
Advertisements