Skip to main content
`Ctrl`+`K`

# pandas.util.hash_pandas_object

pandas.util.hash_pandas_object(obj, index=True, encoding='utf8', hash_key='0123456789123456', categorize=True)

  Return a data hash of the Index/Series/DataFrame.

  The hash is computed element-wise using the underlying data values, and optionally includes the index when hashing a Series or DataFrame.

  Parameters:
    obj Index, Series, or DataFrame

      The pandas object to hash.

    index bool, default True

      Include the index in the hash (if Series/DataFrame).

    encoding str, default ‘utf8’

      Encoding for data & key when strings.

    hash_key str, default _default_hash_key

      Hash_key for string key to encode.

    categorize bool, default True

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

  Returns:
    Series of uint64

      Same length as the object.

  See also

  `util.hash_array`

    Return a hash of the given array.

  `util.hash_tuples`

    Hash a MultiIndex or listlike-of-tuples efficiently.

  Examples

      >>> pd.util.hash_pandas_object(pd.Series([1, 2, 3]))
      0    14639053686158035780
      1     3869563279212530728
      2      393322362522515241
      dtype: uint64