Skip to content

Commit e33b1e5

Browse files
committed
CLN: Verify non-ndarray is an ExtensionArray in hash_array GH42003
1 parent 0b68d87 commit e33b1e5

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

pandas/core/util/hashing.py

+2
Original file line numberDiff line numberDiff line change
@@ -286,6 +286,8 @@ def hash_array(
286286
return _hash_categorical(vals, encoding, hash_key)
287287
elif not isinstance(vals, np.ndarray):
288288
# i.e. ExtensionArray
289+
if not hasattr(vals, '_values_for_factorize'):
290+
raise TypeError("must pass ndarray or ExtensionArray")
289291
vals, _ = vals._values_for_factorize()
290292

291293
return _hash_ndarray(vals, encoding, hash_key, categorize)

0 commit comments

Comments
 (0)