Skip to content

CLN: 29547 replace old string formatting #32034

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
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