Entering edit mode
24 months ago
Paula
▴
60
Hi all!
I have a question. I have the following nested dictionary:
{'Cluster 0': {'samples': {'SOL 1_3'}}}
And I would like to modify the dictionary to include the abundance per sample:
{'Cluster 0': {'samples': {'SOL 1_3':7}}}
I tried this command:
dct_cluster_sol[current_cluster]['samples']['SOL_1_3'] = 7
And it gives this error:
dct_cluster_sol[current_cluster]['samples']['SOL_1_3'] = 7
TypeError: 'set' object does not support item assignment
Do you know how to solve it?
Thank you!
{'Cluster 0': {'samples': {'SOL 1_3'}}}
has the mapping{str -> { str -> set }}
. You probably only need{'Cluster 0': {'samples': dict()}}
Thanks! It worked!