7
7
without warning.
8
8
"""
9
9
import operator
10
- from typing import Any , Callable , Dict , Optional , Sequence , Tuple , Union
10
+ from typing import Any , Callable , Dict , Optional , Sequence , Tuple , Union , cast
11
11
12
12
import numpy as np
13
13
20
20
from pandas .util ._validators import validate_fillna_kwargs
21
21
22
22
from pandas .core .dtypes .cast import maybe_cast_to_extension_array
23
- from pandas .core .dtypes .common import is_array_like , is_list_like , pandas_dtype
23
+ from pandas .core .dtypes .common import (
24
+ is_array_like ,
25
+ is_dtype_equal ,
26
+ is_list_like ,
27
+ pandas_dtype ,
28
+ )
24
29
from pandas .core .dtypes .dtypes import ExtensionDtype
25
30
from pandas .core .dtypes .generic import ABCDataFrame , ABCIndexClass , ABCSeries
26
31
from pandas .core .dtypes .missing import isna
@@ -742,7 +747,7 @@ def searchsorted(self, value, side="left", sorter=None):
742
747
arr = self .astype (object )
743
748
return arr .searchsorted (value , side = side , sorter = sorter )
744
749
745
- def equals (self , other : "ExtensionArray" ) -> bool :
750
+ def equals (self , other : object ) -> bool :
746
751
"""
747
752
Return if another array is equivalent to this array.
748
753
@@ -762,7 +767,8 @@ def equals(self, other: "ExtensionArray") -> bool:
762
767
"""
763
768
if not type (self ) == type (other ):
764
769
return False
765
- elif not self .dtype == other .dtype :
770
+ other = cast (ExtensionArray , other )
771
+ if not is_dtype_equal (self .dtype , other .dtype ):
766
772
return False
767
773
elif not len (self ) == len (other ):
768
774
return False
0 commit comments