If I have a dictionary like this below:
test = {'1629417600000': {'Payload': 1},
'1629418500000': {'Payload': 2},
'1629419400000': {'Payload': 3},
'1629420300000': {'Payload': 4},
'1629421200000': {'Payload': 5},
'1629422100000': {'Payload': 6},
'1629423000000': {'Payload': 7},
'1629423900000': {'Payload': 8},
'1629424800000': {'Payload': 9},
'1629425700000': {'Payload': 10}}
How can I modify the dictionary key names? I am trying to keep the same name but divide as a float by 1000.
This will throw an RuntimeError: dictionary keys changed during iteration
below. Any tips greatly appreciated.
for key in test.keys():
test[str((float(key)/1000))] = test.pop(key)