Movatterモバイル変換


[0]ホーム

URL:


Skip to main content
Ctrl+K

pandas.Interval.is_empty#

Interval.is_empty#

Indicates if an interval is empty, meaning it contains no points.

Returns:
bool or ndarray

A boolean indicating if a scalarInterval is empty, or abooleanndarray positionally indicating if anInterval inanIntervalArray orIntervalIndex isempty.

See also

Interval.length

Return the length of the Interval.

Examples

AnInterval that contains points is not empty:

>>>pd.Interval(0,1,closed='right').is_emptyFalse

AnInterval that does not contain any points is empty:

>>>pd.Interval(0,0,closed='right').is_emptyTrue>>>pd.Interval(0,0,closed='left').is_emptyTrue>>>pd.Interval(0,0,closed='neither').is_emptyTrue

AnInterval that contains a single point is not empty:

>>>pd.Interval(0,0,closed='both').is_emptyFalse

AnIntervalArray orIntervalIndex returns abooleanndarray positionally indicating if anInterval isempty:

>>>ivs=[pd.Interval(0,0,closed='neither'),...pd.Interval(1,2,closed='neither')]>>>pd.arrays.IntervalArray(ivs).is_emptyarray([ True, False])

Missing values are not considered empty:

>>>ivs=[pd.Interval(0,0,closed='neither'),np.nan]>>>pd.IntervalIndex(ivs).is_emptyarray([ True, False])

[8]ページ先頭

©2009-2025 Movatter.jp