I have this data and i need access to the value low, high etc but i don't find a way to do it
im trying this:
data['1. open']
but says keyerror
i can acces to: data['Meta Data'], Time Series (1min)
inclusive i can access to the values low, high.. using the date but the problem is that the date changes so..
hope you guys can help me, thanks!
{
"Meta Data": {
"1. Information": "",
"2. Digital Currency Code": "",
"3. Digital Currency Name": "",
"4. Market Code": "",
"5. Market Name": "",
"6. Last Refreshed": "",
"7. Interval": "",
"8. Output Size": "",
"9. Time Zone": ""
},
"Time Series (1min)": {
"2021-12-30 03:45:00": {
"1. open": "",
"2. high": "",
"3. low": "",
"4. close": "",
"5. volume": 8
},
"2021-12-30 03:44:00": {
"1. open": "",
"2. high": "",
"3. low": "",
"4. close": "",
"5. volume":
},
}
}
CodePudding user response:
Because "1. open"
is nested several levels deep. You would have to use data["Time Series (1min)"]["2021-12-30 03:45:00"]["1. open"]
.
To USE this data, you would iterate through the subkeys, as in
for k,v in data["Time Series (1min)"].items():
prin( k, v["1. open"])