diff --git a/pandas/_libs/sparse.pyx b/pandas/_libs/sparse.pyx index 8d01fe4efe545..b42a9415fbefb 100644 --- a/pandas/_libs/sparse.pyx +++ b/pandas/_libs/sparse.pyx @@ -726,7 +726,7 @@ def make_mask_object_ndarray(ndarray[object, ndim=1] arr, object fill_value): for i in range(new_length): value = arr[i] - if value == fill_value and type(value) == type(fill_value): + if value == fill_value and type(value) is type(fill_value): mask[i] = 0 return mask.view(dtype=bool) diff --git a/pandas/_libs/tslibs/offsets.pyx b/pandas/_libs/tslibs/offsets.pyx index 84b102bd4a262..028e79774607d 100644 --- a/pandas/_libs/tslibs/offsets.pyx +++ b/pandas/_libs/tslibs/offsets.pyx @@ -498,7 +498,7 @@ cdef class BaseOffset: def __sub__(self, other): if PyDateTime_Check(other): raise TypeError("Cannot subtract datetime from offset.") - elif type(other) == type(self): + elif type(other) is type(self): return type(self)(self.n - other.n, normalize=self.normalize, **self.kwds) elif not isinstance(self, BaseOffset): @@ -1047,7 +1047,7 @@ cdef class Tick(SingleConstructorOffset): return other.__add__(self) if isinstance(other, Tick): - if type(self) == type(other): + if type(self) is type(other): return type(self)(self.n + other.n) else: return delta_to_tick(self.delta + other.delta)