Trusted answers to developer questions
Trusted Answers to Developer Questions

Related Tags

pandas

How to use the right attribute of IntervalArray in Pandas

Onyejiaku Theophilus Chidalu

Overview

The right attribute of an IntervalArray object in Pandas returns the right endpoint intervals of the object as an index.

Note: An IntervalArray is an object containing interval data such that they are closed on the same side.

Syntax

The right attribute takes the syntax below:

IntervalArray.right
The syntax for the right attribute in Pandas

Parameter value

The right attribute takes no parameter value.

Return value

The right attribute returns the right endpoints of the IntervalArray object as an index.

Example

# A code to illustrate the right attribute of an IntervalArray object
# Importing the Pandas library
import pandas as pd

# Creating the IntervalArray object
a = pd.arrays.IntervalArray([pd.Interval(0, 4), pd.Interval(1, 5)])

# Printing the IntervalArray object
print(a)

# Obtaining the right endpoints
print(a.right)
Implementing the right attribute of an IntervalArray object

Explanation

  • Line 3: We import the Pandas library.
  • Line 6: We create an IntervalArray object, a.
  • Line 9: We print the value of a.
  • Line 12: Using the right attribute, we obtain the right endpoints of a.

RELATED TAGS

pandas

CONTRIBUTOR

Onyejiaku Theophilus Chidalu
RELATED COURSES

View all Courses

Keep Exploring