My data will likely be in this format:
1-universal
Type_A=10, Type_B=20, Type_C=30
Local set 1:
Type_D=40, Type_C =30, Type_B=10, Type_A=15, Type_E=45
(ie A,B,C,D,E may not be in order)
Local set 2:
Type_C =40, Type_B=5
4,5,6….and so on will have varying types and values respectively.
Each time I have to compare universal with an individual local set and take the max. Here 1 represents universal, and I will be getting the other values sequentially. I have to take the max of each type and store it as:
Local set 1:
A=15, B=20, C=30, D=40, E=45
(D,E not present in universal so we take local set 1’s values)
Local set 2:
B=20, C=40
Which is the best datastructure in python to compute the same? Option I have considered(local setwise):
Dictionary of local sets of dictionaries of types with lists as values
{
1:{A:[10,40], B:[20,10], C:[30,30], D:[0,40], E:[0,45]},
2:{ B:[20,5], C:[30,40]
}
Please note types are actually not sequential and may get appended in any order ie A,B,C,D,E may very likely be D,A,C,B,E etc.
I would be grateful if anyone would tell me how to reference the same as well as I am new to python. (For eg, how would I access or store 40 in local set 2 of type C)
I am working with python 2.6. Thanks in advance.