I am calling an API with requests as follows:
def get_data(text, url='api.com'):
r = requests.get(url,
params={'key': '<My KEY>',
'in': text
'fj': 'm'})
if r.status_code != requests.codes.ok:
return np.nan
return r.json()
Each row looks like this:
{'A': [{'param0': 'a',
'param1': 'b',
'param2': '342',
'param3': '$ 2342',
'param4': '234',
'param5': '555'}],
'status': {'code': '0', 'credits': '1', 'msg': 'OK'}}
How can I transform each column in to a tuple like this:
[('param0','a'), ('param1','b'), ('param2', '342'), ('param3', '$ 2342'), ('param5', '555')]
At first instance I tried to parse the above output, however I can not access since I get:
TypeError: the JSON object must be str, not 'float'
Any idea of how to get the list of tuples?.