mirror of
https://github.com/webclinic017/drift.git
synced 2026-07-27 18:57:55 +00:00
10 lines
320 B
Python
10 lines
320 B
Python
|
|
from hashlib import sha256
|
||
|
|
import pandas as pd
|
||
|
|
|
||
|
|
def hash_df(df: pd.DataFrame) -> str:
|
||
|
|
s = str(df.columns) + str(df.index) + str(df.values)
|
||
|
|
return sha256(s.encode()).hexdigest()
|
||
|
|
|
||
|
|
def hash_series(df: pd.Series) -> str:
|
||
|
|
s = str(df.name) + str(df.index) + str(df.values)
|
||
|
|
return sha256(s.encode()).hexdigest()
|