title: Creating a pandas dataframe from the retrieved json file from an API
body: <p>I have an API that I am retrieving data from (json format). I am trying to read the json file into a clean pandas dataframe.</p>
  <p>Here's my code:</p>
  <pre><code>sensors = ['LF5-C122', 'LF5-F2F8', 'LF5-D4BD', 'LF5-EC05']
  results = []
  
  # Iterate get urls and retrieve json files
  for sensor in sensors:
      res = requests.get(f'https://apiv.test.io/sensors/{sensor}/CO2ppm/history?tstart={timestamp1}&amp;tend={timestamp2}', headers=headers)
      if res.status_code == 200:
          results.append(res.json())
      else:
          print(f'Request to {sensor} failed.')
  </code></pre>
  <p>Now after accessing results[0], I get the json file that has 'time' and 'value'</p>
  <p>{'time': [1640991907,
  1640992507,
  1640993109,
  1640993709,
  1640994309],</p>
  <p>'value': [232,421,123,534,123]
  }</p>
  <p>How can I read this data into a pandas dataframe with 2 columns, one for time and one for value? The expected output is 4 dataframes (one for each sensor).</p>
  <p>Can I in a way add it to my existing function or do I have to do it seperately?</p>
  <p>Current output (using pd.DataFrame):</p>
  <p><a href="https://i.stack.imgur.com/Q3y1k.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Q3y1k.png" alt="enter image description here" /></a></p>
  <p>I am trying to get time and value to be the headers and then time[0] value[0] become one row, time<a href="https://i.stack.imgur.com/Q3y1k.png" rel="nofollow noreferrer">1</a> and value<a href="https://i.stack.imgur.com/Q3y1k.png" rel="nofollow noreferrer">1</a> become another row, etc.</p>