I have a list of rows...
rows = [2, 21]
And a dictionary of data...
data = {'x': [46, 35], 'y': [20, 30]}
I'd like to construct a second dictionary, dataRows, keyed by the row that looks like this...
dataRows = {2: {'x': 46, 'y': 20}, 21: {'x': 35, 'y': 30}}
I tried the following code, but the values of dataRows are always the same (last value in loop):
for i, row in enumerate(rows):
for key, value in data.items():
dataRows[row] = value[i]
Any assistance would be greatly appreciated.
