I need to query in an online database, and transform the returned data into a data frame.
I used an existing example on the database website, but I have no idea how to turn it into a database.
The example looks like this sample:
import urllib
url = 'http://dados.cvm.gov.br/api/action/datastore_search?resource_id=92741280-58fc-446b-b436-931faaca4fb4&limit=5&q=_id:01'
fileobj = urllib.request.urlopen(url)
read_file = fileobj.read()
print (read_file)
And as a result, I got this:
b '{"help": " link ", "success": true, "result": {"resource_id": "92741280-58fc-446b-b436-931faaca4fb4", "fields": [{"type": "int4", "id": "_id"}, {"type": "text", "id": "CNPJ_FUNDO"}, {"type": "timestamp", "id": "DT_COMPTC"}, {"type": "numeric", "id": "VL_TOTAL"}, {"type": "numeric", "id": "VL_QUOTA"}, {"type": "numeric", "id": "VL_PATRIM_LIQ"}, {"type": "numeric", "id": "CAPTC_DIA"}, {"type": "numeric", "id": "RESG_DIA"}, {"type": "numeric", "id": "NR_COTST"}, {"type": "int8", "id": "_full_count"}, {"type": "float4", "id": "rank"}], "q": "_id = 01", "records": [], "_links": {"start": "/ api / action / datastore_search? q = _id% 3D01 & limit = 5 & resource_id = 92741280-58fc-446b-b436-931faaca4fb4" "next": "/ api / action / datastore_search? q = _id% 3D01 & offset = 5 & limit = 5 & resource_id = 92741280-58fc-446b-b436-931faaca4fb4"}, "limit": 5}} '
How can I turn this result into a dataframe?
Source Website: link
If it is useful, from what I read on the source website, the data is made available using CKAN.