DEV Community

buhtz
buhtz

Posted on

How to know if a Pandas DataFrame was modified

I would like to know if a pandas.DataFrame was modified or not.

One idea is to create a hash value for the whole data frame.

# Credits: https://stackoverflow.com/a/62754084/4865723
hashlib.sha1(pd.util.hash_pandas_object(df).values).hexdigest()

But I wonder if there might be another way doing this. Any ideas?

Top comments (0)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay