I'd like to access a data structure which looks like this below.
"key" is obviously the key here. So I'm expecting to be able to write something like EnergyData["key"]["en"]["Import Balance"][0] to access the first number stored in the list of values. But how do I type this, and how do I interpret this data structure? It's a list, with dict elements and then a list with data?
EnergyData
[{'key': [{'en': 'Import Balance',
'de': 'Import Saldo',
'fr': 'Solde des importations',
'it': 'Saldo del Importazione'}],
'color': 'rgb(125,25,125)',
'chartType': 'multiChart',
'chartTitle': [{'en': 'Electricity production and spot prices in Germany in 2019',
'de': 'Stromproduktion und Börsenstrompreise in Deutschland in 2019',
'fr': "Production électrique et prix d'échange (spot) de l'électricité en Allemagne en 2019",
'it': 'La produzione di elettricità e spot price in Germania in 2019'}],
'xAxisFormat': 'unixTime',
'xAxisLabel': [{'en': 'Date', 'de': 'Datum', 'fr': 'Date', 'it': 'Data'}],
'y1AxisLabel': [{'en': 'Power (GW)',
'de': 'Leistung (GW)',
'fr': 'Puissance (GW)',
'it': 'Prestazione (GW)'}],
'y1AxisDecimalPlaces': 2,
'y2AxisLabel': [{'en': 'Price (Euro\u200a/\u200aMWh, Euro\u200a/\u200at\u200aCO2)',
'de': 'Preis (Euro\u200a/\u200aMWh, Euro\u200a/\u200at\u200aCO2)',
'fr': 'Prix (Euro\u200a/\u200aMWh, Euro\u200a/\u200at\u200aCO2)',
'it': 'Prestazione (Euro\u200a/\u200aMWh, Euro\u200a/\u200at\u200aCO2)'}],
'y2AxisDecimalPlaces': 2,
'datasource': 'EPEX SPOT, 50 Hertz, Amprion, Tennet, TransnetBW',
'date': 1588597666000,
'type': 'area',
'yAxis': '1',
'values': [[1546297200000, -10.903],
[1546300800000, -10.997],
[1546304400000, -11.824],
[1546308000000, -11.964],
[1546311600000, -12.62],
[1546315200000, -13.395],
[1546318800000, -13.692],
[1546322400000, -14.037],
[1549882800000, -9.639],
[1549886400000, -8.662],
[1549890000000, -8.091],
[1549893600000, -8.378],
...]},
{'key': [{'en': 'Conventional > 100 MW',
'de': 'Konventionell > 100 MW',
'fr': 'Conventionnel > 100 MW',
'it': 'Convenzionale > 100 MW'}],
'color': 'rgb(158,152,148)',
'type': 'area',
'yAxis': '1',
'values': [[1546297200000, 21.848],
[1546300800000, 19.218],
[1546304400000, 18.027],
[1546308000000, 17.161],
[1546311600000, 16.942],
[1546315200000, 16.703],
[1546318800000, 16.569],
[1546322400000, 16.709],
EnergyData[0]["key"][0]["en"]would result in"Import Balance". The first number (1546297200000) stored in the list of values would beEnergyData[0]["values"][0][0]. Just navigate it like you would with addresses consisting of country, state, zip code, street name, house number, appartment number. Use strings (in this case) for dictionaries and integers for lists.EnergyData[0]['values'][0][0], no?