Cache with dictionnary and custom object

Hi everyone,

I need to process data then read it. To do it, I use the load_dat function :

def load_data(path):
data = dict()
data[‘1’] = pd.read_csv(os.path.join(path, ‘test1.csv’))
data[‘2’] = custom_function((os.path.join(path,‘test2.csv’))
return data

If I understand well Streamlit cannot hash an object of type <class ‘dict’>.
How can I use the cache in this situation ?

hash the dictionnary with hash() is possible ?

Thank for your help ! :slight_smile:

Hi @coolpix,

Welcome to the forum!

I believe the issue lies in the custom_function. Does it return a custom object?
Streamlit is able to hash dicts, but we don’t support hashing custom objects yet (will do in about a month). In the meantime, please take a look at and

I hope they will shed some light on the issue. If not I’m we’re always here to help!

1 Like

Hello @kantuni

Thanks for your answer. It’s odd because the error is quite explicit about the fact that Streamlit can’t hash dict.
As you say the problem is the custom function that returns custom object. Glad to hear Streamlit will support custom objects soon!

Can you post the exact error? Maybe that will help :slight_smile: