Skip to content

Instantly share code, notes, and snippets.

@nguyenhieuec
Created July 10, 2020 11:36
Show Gist options
  • Select an option

  • Save nguyenhieuec/bde8f4160f2a0927d4796e7f2a7a5e85 to your computer and use it in GitHub Desktop.

Select an option

Save nguyenhieuec/bde8f4160f2a0927d4796e7f2a7a5e85 to your computer and use it in GitHub Desktop.
Create a hash column in pandas elegent way
df['hash'] = (
(df['col1'].astype(str) + df['col2'].astype(str) + df['col3'].astype(str))
.pipe(pd.util.hash_pandas_object)
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment