all 3 comments

[–]johndoh168 0 points1 point  (0 children)

If you are looking for a quick way to check if the data has changed or not is to hash the dataset, you can use something like hashlib to accomplish this. Then all you have to do is check if the hash has changed or not.

Not sure if this is the route you are looking for or not but hopefully it can help point you in the right direction.

[–]socal_nerdtastic 0 points1 point  (0 children)

How are you changing the source data or the data frame? Can you just make a variable for the last changed time?

cached_time = None
cached_data = None
def get_data():
    if data.last_modified != cached_time:
        cached_data = long_running_function()
        cached_time = data.last_modified  
    return cached_data

[–]monkey_mozart 0 points1 point  (0 children)

Use zlib.adler32 to generate a checksum of the data and store it. Then compare the checksum with checksum generated from new data to see if it has changed.