dict_values(
[{'2020-01-01': 6756.5667752718,
'2020-02-01': 6977.2782868586,
'2020-03-01': 8345.9643411143,
'2020-04-01': 10279.6946142039,
'2020-05-01': 950.3290972804},
{'2020-01-01': 807.2855755452,
'2020-02-01': 807.2872293898,
'2020-03-01': 1006.1969492287,
'2020-04-01': 1006.262393842,
'2020-05-01': 151.882531899}])
I want to change the values of key, example INPUT '2020-01-01': 6756.5667752718 ... OUTPUT = 'JAN' : 6756.5667752718 I have a function which converts the date
so I've to rename the keys using below function.
MONTHS = ['JAN', 'FEB', 'MAR', 'APR', 'MAY',
'JUN','JUL', 'AUG', 'SEP', 'OCT', 'NOV', 'DEC']
def date_convert(s):
y = s[:4]
m = int(s[5:-3])
d = s[8:]
month_name = MONTHS[m-1]
result= month_name
return result
s = '2020-06-24'
r = date_convert(s)