pandas.util.hash_array

pandas.util.hash_array(vals, encoding='utf8', hash_key=None, categorize=True)[source]

Given a 1d array, return an array of deterministic integers.

New in version 0.19.2.

Parameters:
vals : ndarray, Categorical
encoding : string, default ‘utf8’

encoding for data & key when strings

hash_key : string key to encode, default to _default_hash_key
categorize : bool, default True

Whether to first categorize object arrays before hashing. This is more efficient when the array contains duplicate values.

New in version 0.20.0.

Returns:
1d uint64 numpy array of hash values, same length as the vals
Scroll To Top