I have a dict()
with 1000 keys. First 4 entries of dict are like.
{
'aaa': [1,0,6,8,0,5,9,1,1,0],
'abc': [1,1,1,2,4,0,0,0,9,8],
'cfg': [0,0,0,4,3,1,0,0,0,1],
'cghjj': [7,8,9,2,3,0,0,0,0,0]
}
I want to create a dataset using each key one by one. I want to pick key1
. Then create a dataset using function1
using the values of key1
and then pick key2
. Creating another dataset using values of key2
and appending the result of key2
to key1
row-wise. Then with key3
... and then append the result to the result of key1
and key2
and so on.. up to 1000 keys.
dataset=dict()
create_dataset:
select values of key 1.
b1=function1()
b1=np.asarray(b1)
then select key 2.
b2=function1()
b2=np.asarray(b2)
np.append(b1,b2,axis=0)
...upto 1000 key.
for key,values in dataset.items: print key, value.
It will print all keys with values. can we do some computation on each key's values before or after printing. Like it should pick key1..perform function 1on key. then pick key2. Basically i am not able to pick keys in order through looping. Before keys are in not numbers ..they are some names and i can pick them manually each time as they are 1000 in number. so i want some automatic way of pick each key. $\endgroup$for key in sorted(dataset.keys()):
. $\endgroup$