I declared a python dictionary with key and value as multiple array. Is it possible to append an array using the key and value index?
This is the way I initialized the python dictionary cvfoldacc
a = []
b = []
c = []
d = []
e = []
f = []
classifiers = [a,b,c,d,e,f]
cvfoldacc = dict.fromkeys(range(2,11), classifiers)
And the result of this initialization is as follows:
cvfoldacc>>
{2: [[], [], [], [], [], []],
3: [[], [], [], [], [], []],
4: [[], [], [], [], [], []],
5: [[], [], [], [], [], []],
6: [[], [], [], [], [], []],
7: [[], [], [], [], [], []],
8: [[], [], [], [], [], []],
9: [[], [], [], [], [], []],
10: [[], [], [], [], [], []]}
When I tried to append the first list of key(2) with the code cvfoldacc[2][0].append(8), I am getting the result as:
{2: [[8], [], [], [], [], []],
3: [[8], [], [], [], [], []],
4: [[8], [], [], [], [], []],
5: [[8], [], [], [], [], []],
6: [[8], [], [], [], [], []],
7: [[8], [], [], [], [], []],
8: [[8], [], [], [], [], []],
9: [[8], [], [], [], [], []],
10: [[8], [], [], [], [], []]}
But the expected answer should be this:
{2: [[8], [], [], [], [], []],
3: [[], [], [], [], [], []],
4: [[], [], [], [], [], []],
5: [[], [], [], [], [], []],
6: [[], [], [], [], [], []],
7: [[], [], [], [], [], []],
8: [[], [], [], [], [], []],
9: [[], [], [], [], [], []],
10: [[], [], [], [], [], []]}