Skip to content

Commit

Permalink
Ignore possible RuntimeWarning in _hash_ndarray
Browse files Browse the repository at this point in the history
  • Loading branch information
mroeschke committed Dec 12, 2024
1 parent 13e2df0 commit 1c9a763
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions pandas/core/util/hashing.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

import itertools
from typing import TYPE_CHECKING
import warnings

import numpy as np

Expand Down Expand Up @@ -334,9 +335,15 @@ def _hash_ndarray(
vals = hash_object_array(vals, hash_key, encoding)
except TypeError:
# we have mixed types
vals = hash_object_array(
vals.astype(str).astype(object), hash_key, encoding
)
with warnings.catch_warnings():
warnings.filterwarnings(
"ignore",
"invalid value encountered in cast",
RuntimeWarning,
)
vals = hash_object_array(
vals.astype(str).astype(object), hash_key, encoding
)

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

0 comments on commit 1c9a763

Please sign in to comment.