pandas.api.extensions.ExtensionArray._hash_pandas_object#
- ExtensionArray._hash_pandas_object(*, encoding, hash_key, categorize)[source]#
Hook for hash_pandas_object.
Default is to use the values returned by _values_for_factorize.
- Parameters:
- encodingstr
Encoding for data & key when strings.
- hash_keystr
Hash_key for string key to encode.
- categorizebool
Whether to first categorize object arrays before hashing. This is more efficient when the array contains duplicate values.
- Returns:
- np.ndarray[uint64]
An array of hashed values.
See also
api.extensions.ExtensionArray._values_for_factorize
Return an array and missing value suitable for factorization.
util.hash_array
Given a 1d array, return an array of hashed values.
Examples
>>> pd.array([1, 2])._hash_pandas_object( ... encoding="utf-8", hash_key="1000000000000000", categorize=False ... ) array([ 6238072747940578789, 15839785061582574730], dtype=uint64)