Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions pandas/core/arrays/interval.py
Original file line number Diff line number Diff line change
Expand Up @@ -195,13 +195,13 @@ def _simple_new(
left = ensure_index(left, copy=copy)
right = ensure_index(right, copy=copy)

if dtype is not None:
if dtype:
# GH 19262: dtype must be an IntervalDtype to override inferred
dtype = pandas_dtype(dtype)
if not is_interval_dtype(dtype):
msg = f"dtype must be an IntervalDtype, got {dtype}"
raise TypeError(msg)
elif dtype.subtype is not None:
elif dtype.subtype:
left = left.astype(dtype.subtype)
right = right.astype(dtype.subtype)

Expand Down Expand Up @@ -637,9 +637,9 @@ def fillna(self, value=None, method=None, limit=None):
-------
filled : IntervalArray with NA/NaN filled
"""
if method is not None:
if method:
raise TypeError("Filling by method is not supported for IntervalArray.")
if limit is not None:
if limit:
raise TypeError("limit is not supported for IntervalArray.")

if not isinstance(value, ABCInterval):
Expand Down Expand Up @@ -1149,7 +1149,7 @@ def __arrow_array__(self, type=None):
children=[storage_array.field(0), storage_array.field(1)],
)

if type is not None:
if type:
if type.equals(interval_type.storage_type):
return storage_array
elif isinstance(type, ArrowIntervalType):
Expand Down