how to convert dict to pickle file

PHOTO EMBED

Wed Jun 19 2024 08:45:33 GMT+0000 (Coordinated Universal Time)

Saved by @freepythoncode ##python #coding #python #programming #pickle

import pandas as pd

dict_data = {
    'users': ['user_123', 'user_abc'],
    'tasks': ['test1', 'test2']
}

df = pd.DataFrame.from_dict(dict_data)
df.to_pickle('out.pkl')

# read pkl file
print(pd.read_pickle('out.pkl'))
content_copyCOPY