I have the following code:
data_keys = data.keys()
for i in range(1,len(data_keys)):
multiplier = specie_name_and_initial_values_dict[data_keys[i]]
data[data_keys[i]]=map(lambda x: multiplier*x, data[data_keys[i]])
return data
data_keys is a list of keys derived from a pandas dataframe i.e.
Index([u'Time', u'Cyp26_G_R1', u'Cyp26_G_rep1'], dtype='object')
data is a pandas data frame, i.e.:
Time Cyp26_G_R1 Cyp26_G_rep1
0 0 0.0 14.0
1 300 0.0 10.0
2 600 1.0 1.5
3 900 2.0 2.0
4 1200 2.5 1.0
5 1500 4.0 0.9
6 1800 2.0 2.0
7 2100 2.5 2.5
8 2400 5.0 2.5
9 2700 6.5 0.5
10 3000 6.0 0.4
11 3300 5.5 0.5
12 3600 1.5 1.5
and specie_name_and_initial_values_dict is a dictionary with 35 keys, one value in each key and two of those keys have the same name as the column headers in the data frame above (not 'Time').
I'm trying to multiply the two data columns of my data frame by each of the two values that I get from the 'specie_name_and_initial_values_dict[data_keys[i]]' within the loop.
I cannot paste my current output because stack overflow doesn't like the format but what is currently happening is the multiplication is not occurring and the numbers are iteratively being spliced i.e. first element = 240.8856716, second = 240.8856716240.8856716 and this continues.
This is obviously not what I want. Does anybody know a way to do this?