generic_list = ['A1', 'B2', 'C3', 'D4', 'E5', 'F6']
empty_dict = [{}]
generic_CT_curves_month = [np.datetime64('2022-12-01T00:00:00.000000000'),
np.datetime64('2023-03-01T00:00:00.000000000'),
np.datetime64('2023-05-01T00:00:00.000000000'),
np.datetime64('2023-07-01T00:00:00.000000000'),
np.datetime64('2023-10-01T00:00:00.000000000'),
np.datetime64('2023-12-01T00:00:00.000000000')]
generic_curves_dict = dict(zip(generic_list, empty_dict * 6))
print(generic_curves_dict)
for ticker in generic_curves_dict:
generic_curves_dict[str(ticker)]['month'] = generic_CT_curves_month[int(ticker[-1])-1]
generic_curves_dict
output:
{'A1': {'month': numpy.datetime64('2023-12-01T00:00:00.000000000')},
'B2': {'month': numpy.datetime64('2023-12-01T00:00:00.000000000')},
'C3': {'month': numpy.datetime64('2023-12-01T00:00:00.000000000')},
'D4': {'month': numpy.datetime64('2023-12-01T00:00:00.000000000')},
'E5': {'month': numpy.datetime64('2023-12-01T00:00:00.000000000')},
'F6': {'month': numpy.datetime64('2023-12-01T00:00:00.000000000')}}
I want generic_curves_dict['A1']['month'] to call the first date from generic_CT_curves_month and so on. How do I do that?
empty_dict * 6causes the same problem described here.