Skip to content

Commit 1c9a763

Browse files
committed
Ignore possible RuntimeWarning in _hash_ndarray
1 parent 13e2df0 commit 1c9a763

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

pandas/core/util/hashing.py

+10-3
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
import itertools
88
from typing import TYPE_CHECKING
9+
import warnings
910

1011
import numpy as np
1112

@@ -334,9 +335,15 @@ def _hash_ndarray(
334335
vals = hash_object_array(vals, hash_key, encoding)
335336
except TypeError:
336337
# we have mixed types
337-
vals = hash_object_array(
338-
vals.astype(str).astype(object), hash_key, encoding
339-
)
338+
with warnings.catch_warnings():
339+
warnings.filterwarnings(
340+
"ignore",
341+
"invalid value encountered in cast",
342+
RuntimeWarning,
343+
)
344+
vals = hash_object_array(
345+
vals.astype(str).astype(object), hash_key, encoding
346+
)
340347

341348
# Then, redistribute these 64-bit ints within the space of 64-bit ints
342349
vals ^= vals >> 30

0 commit comments

Comments
 (0)