Movatterモバイル変換


[0]ホーム

URL:


Skip to main content
Ctrl+K

pandas.IntervalIndex.overlaps#

IntervalIndex.overlaps(*args,**kwargs)[source]#

Check elementwise if an Interval overlaps the values in the IntervalArray.

Two intervals overlap if they share a common point, including closedendpoints. Intervals that only have an open endpoint in common do notoverlap.

Parameters:
otherIntervalArray

Interval to check against for an overlap.

Returns:
ndarray

Boolean array positionally indicating where an overlap occurs.

See also

Interval.overlaps

Check whether two Interval objects overlap.

Examples

>>>data=[(0,1),(1,3),(2,4)]>>>intervals=pd.arrays.IntervalArray.from_tuples(data)>>>intervals<IntervalArray>[(0, 1], (1, 3], (2, 4]]Length: 3, dtype: interval[int64, right]
>>>intervals.overlaps(pd.Interval(0.5,1.5))array([ True,  True, False])

Intervals that share closed endpoints overlap:

>>>intervals.overlaps(pd.Interval(1,3,closed='left'))array([ True,  True, True])

Intervals that only have an open endpoint in common do not overlap:

>>>intervals.overlaps(pd.Interval(1,2,closed='right'))array([False,  True, False])

[8]ページ先頭

©2009-2025 Movatter.jp