Best way of saving and retreiving the sampleset data ?

Hi all, I would like to know how to save and retreive the multiple samplesets. 

I tried json.dumps and it worked for a while and saved the data in json format. Now it seems klike that this method does not work anymore. 

I tried the following code:

with open(f'test.json', 'w') as f:
    serializable_data = sample_set.to_serializable()

    if isinstance(serializable_data, np.ndarray):
        serializable_data = serializable_data.tolist()
    elif isinstance(serializable_data, type):
        serializable_data = str(serializable_data)
    serialized_data = json.dumps(serializable_data)
    f.write(serialized_data + '\n')


I got he following error: 

TypeError: Object of type type is not JSON serializable

Any help is much appreciated.

Thank you.




1 comment

Please sign in to leave a comment.

Didn't find what you were looking for?

New post