I have a dictionary of pandas dfs which I convert to a pickle file like this:
with open('performance.pkl', 'wb') as handle:
pickle.dump(performance, handle, protocol=pickle.HIGHEST_PROTOCOL)
Then I load the pickle file like this:
with open('performance.pkl', 'rb') as handle:
a = pickle.load(handle)
When I inspect the contents of the dictionaries "performance" and "a", they are identical, however, if I do:
a == performance
I get:
ValueError: The truth value of a DataFrame is ambiguous. Use a.empty, a.bool(), a.item(), a.any() or a.all().
Furthermore:
a.keys() == performance.keys()
True
a.values == performance.values()
False
(type(a), type(performance)
(dict, dict)
Also, when lopping and comparing the DFs inside "a" and the DFs inside "performance" one by one, they are identical.
Since I am comparing python dictionaries, I am not sure what the problem is. I would not like to loop over the DFs inside "a" and "performance" one by one, since the there are many indices inside each and it takes time.
Btw, I don't need to necessarily save as pickle, but any other format that allows me to save the dictionary.