I have a dictionary, and for each key in my dictionary, I have one pandas dataframe. The dataframes from key to key are of unequal length.
It takes some time to get to the dataframes that are connected to each key, and therefore I wish to save my dictionary of dataframes to a file, so I can just read the file into Python instead of running my script every time I open Python.
My question is: How would you suggest to write the dictionary with dataframes to a file - and to read it in again? I have tried the following, where dictex is the dictionary:
w = csv.writer(open("output.csv", "w"))
for key, val in dictex.items():
w.writerow([key, val])
But I am not really sure if I get what I want, as I struggle to read the file into Python again.
Thank you for your time.