Skip to content

Commit 7a1d715

Browse files
authored
CLN: remove unused util.hashing functions (#33511)
1 parent e10175f commit 7a1d715

File tree

1 file changed

+0
-37
lines changed

1 file changed

+0
-37
lines changed

pandas/core/util/hashing.py

-37
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,8 @@
66

77
import numpy as np
88

9-
from pandas._libs import Timestamp
109
import pandas._libs.hashing as hashing
1110

12-
from pandas.core.dtypes.cast import infer_dtype_from_scalar
1311
from pandas.core.dtypes.common import (
1412
is_categorical_dtype,
1513
is_extension_array_dtype,
@@ -21,7 +19,6 @@
2119
ABCMultiIndex,
2220
ABCSeries,
2321
)
24-
from pandas.core.dtypes.missing import isna
2522

2623
# 16 byte long hashing key
2724
_default_hash_key = "0123456789123456"
@@ -299,37 +296,3 @@ def hash_array(
299296
vals *= np.uint64(0x94D049BB133111EB)
300297
vals ^= vals >> 31
301298
return vals
302-
303-
304-
def _hash_scalar(
305-
val, encoding: str = "utf8", hash_key: str = _default_hash_key
306-
) -> np.ndarray:
307-
"""
308-
Hash scalar value.
309-
310-
Parameters
311-
----------
312-
val : scalar
313-
encoding : str, default "utf8"
314-
hash_key : str, default _default_hash_key
315-
316-
Returns
317-
-------
318-
1d uint64 numpy array of hash value, of length 1
319-
"""
320-
if isna(val):
321-
# this is to be consistent with the _hash_categorical implementation
322-
return np.array([np.iinfo(np.uint64).max], dtype="u8")
323-
324-
if getattr(val, "tzinfo", None) is not None:
325-
# for tz-aware datetimes, we need the underlying naive UTC value and
326-
# not the tz aware object or pd extension type (as
327-
# infer_dtype_from_scalar would do)
328-
if not isinstance(val, Timestamp):
329-
val = Timestamp(val)
330-
val = val.tz_convert(None)
331-
332-
dtype, val = infer_dtype_from_scalar(val)
333-
vals = np.array([val], dtype=dtype)
334-
335-
return hash_array(vals, hash_key=hash_key, encoding=encoding, categorize=False)

0 commit comments

Comments
 (0)