选择一列时,如何只获取列表而不是字典列表?
When selecting one column how do I just get a list instead of a list of dictionaries?
输出为
[{"categories":"Training|Use of Force"}
,{"categories":"Narcotics"}
,{"categories":"Traffic|Assist"}
,{"categories":"Burglary"}
,{"categories":"Crisis"} ...
如何使输出为:
["Training|Use of Force", "Narcotics", "Traffic|Assist", "Burglary", "Crisis",...]
?
您可以请求 csv
端点,而不是请求 json
端点(这会导致您返回一个 objects 的数组):
这 returns 一个 header 行 ("categories"
),然后每个 non-null 类别作为常规字符串,在其自己的行上:
"categories"
"Training|Use of Force"
"Narcotics"
"Traffic|Assist"
"Burglary"
"Crisis"
...
输出为
[{"categories":"Training|Use of Force"}
,{"categories":"Narcotics"}
,{"categories":"Traffic|Assist"}
,{"categories":"Burglary"}
,{"categories":"Crisis"} ...
如何使输出为:
["Training|Use of Force", "Narcotics", "Traffic|Assist", "Burglary", "Crisis",...]
?
您可以请求 csv
端点,而不是请求 json
端点(这会导致您返回一个 objects 的数组):
这 returns 一个 header 行 ("categories"
),然后每个 non-null 类别作为常规字符串,在其自己的行上:
"categories"
"Training|Use of Force"
"Narcotics"
"Traffic|Assist"
"Burglary"
"Crisis"
...