Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to convert a list of data in Python to a Dictionary where each item has a key

Google={}
Google["Price"]=[317.68,396.05,451.48,428.03,516.26,604.83,520.63,573.48,536.51,542.84,533.85,660.87,728.9]

I have a dictionary "Google" where the the key value shows 36 values for Google. Is there a way to give each entry a separate key (where 317.68 is 1, 396.05 is 2, etc)?

like image 412
Jim Avatar asked Dec 15 '22 10:12

Jim


1 Answers

dict(enumerate(google_price_data, start=1))
like image 108
Paweł Kordowski Avatar answered May 22 '23 13:05

Paweł Kordowski