小编Edw*_*rán的帖子

为什么我在迭代 28 后收到错误:“JSONDecodeError:期望值:第 1 行第 1 列(字符 0)”?

我正在尝试从政府的 API 中提取数据。该 API 分为多个页面,每页有 10 个观察结果。我编写了一个算法,可以从每个观察中获取重要信息并将其添加到 pandas 数据框中。一切都很顺利,直到我到达迭代 29,此时我收到了标题中提到的错误。

\n

这是我写的代码:

\n
#Database Creation Using API\n#Import Libraries\nimport requests\nimport pandas as pd\n\n#Define a list of relevant variables to automatize information acquisition\nrelevant_vars = ["year","ocid","date","region","title","description","suppliers","buyer","amount"\\\n                 ,"budget"]#Define a list of relevant variables to automatize information acquisition\n\n#Creation of empty Pandas Dataframe to save all the pertinent information from the database.\ndata_collected = pd.DataFrame(columns = relevant_vars)\n\n#Access to API's data\n#API number 1: "B\xc3\xbasqueda de procesos de contrataci\xc3\xb3n por medio de palabra"\n\n#Need an initial response to start while …
Run Code Online (Sandbox Code Playgroud)

python json python-3.x

5
推荐指数
1
解决办法
4万
查看次数

标签 统计

json ×1

python ×1

python-3.x ×1