def _hash_categorical(c, encoding, hash_key):
<EOL>values = np.asarray(c.categories.values)<EOL>hashed = hash_array(values, encoding, hash_key,<EOL>categorize=False)<EOL>mask = c.isna()<EOL>if len(hashed):<EOL><INDENT>result = hashed.take(c.codes)<EOL><DEDENT>else:<EOL><INDENT>result = np.zeros(len(mask), dtype='<STR_LIT>')<EOL><DEDENT>if mask.any():<EOL><INDENT>result[mask] = np.iinfo(np.uint64).max<EOL><DEDENT>return result<EOL>
Hash a Categorical by hashing its categories, and then mapping the codes
to the hashes

Parameters
----------
c : Categorical
encoding : string, default 'utf8'
hash_key : string key to encode, default to _default_hash_key

Returns
-------
ndarray of hashed values array, same size as len(c)