Skip to content

Commit af73848

Browse files
lukemanleyjamie-harness
authored andcommitted
PERF: ArrowDtype.__eq__ (pandas-dev#54223)
* PERF: ArrowDtype.__eq__ * cleanup
1 parent d5f14dc commit af73848

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

pandas/core/dtypes/dtypes.py

+9
Original file line numberDiff line numberDiff line change
@@ -2056,6 +2056,15 @@ def __init__(self, pyarrow_dtype: pa.DataType) -> None:
20562056
def __repr__(self) -> str:
20572057
return self.name
20582058

2059+
def __hash__(self) -> int:
2060+
# make myself hashable
2061+
return hash(str(self))
2062+
2063+
def __eq__(self, other: Any) -> bool:
2064+
if not isinstance(other, type(self)):
2065+
return super().__eq__(other)
2066+
return self.pyarrow_dtype == other.pyarrow_dtype
2067+
20592068
@property
20602069
def type(self):
20612070
"""

0 commit comments

Comments
 (0)