pandas.util.hash_array

pandas.util.hash_array(vals, encoding: str = 'utf8', hash_key: str = '0123456789123456', categorize: bool = True)[source]

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

Parameters
valsndarray, Categorical
encodingstr, default ‘utf8’

Encoding for data & key when strings.

hash_keystr, default _default_hash_key

Hash_key for string key to encode.

categorizebool, default True

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

Returns
1d uint64 numpy array of hash values, same length as the vals