I am working with the opensky network api: https://opensky-network.org/apidoc/python.html
I am calling the api via the python library they've created and am looking to turn the object returned into a dataframe. Below is a snippet of what it looks like, how would i go about turning this into a dataframe?
from opensky_api import OpenSkyApi
import numpy as np
import pandas as pd
from pandas.io.json import json_normalize
api = OpenSkyApi()
states = api.get_states()
for s in states.states[0:2]:
print("(%r, %r, %r, %r)" % (
s.longitude,
s.latitude,
s.baro_altitude,
s.velocity
)
)
Here is the structure of the states object:
{ 'states': [
StateVector(dict_values(['a2e5ec', 'SKW3594 ', 'United States', 1585323288, 1585323288, -116.2179, 43.567, None, True, 3.09, 292.5, None, None, None, '1130', False, 0])),
StateVector(dict_values(['a57b1e', 'N452SD ', 'United States', 1585323339, 1585323339, -88.496, 37.7587, 12192, False, 188.65, 218.24, 0, None, 12519.66, '6263', False, 0]))
],'time': 1585323340}