我正在尝试使用SODA API从以下链接导入数据,并将其加载到数据框中。我以前从未使用过SODA API,有人可以建议一个好的模块或如何做到这一点吗?
https://health.data.ny.gov/Health/Medicaid-Potentially-Preventable-Emergency-Visit-P/cr7a-34ka
答案 0 :(得分:1)
下面的代码可以解决问题:
代码:
import pandas as pd
from sodapy import Socrata
# Unauthenticated client only works with public data sets. Note 'None'
# in place of application token, and no username or password:
client = Socrata("health.data.ny.gov", None)
# First 2000 results, returned as JSON from API / converted to Python list of
# dictionaries by sodapy.
Results = client.get("cr7a-34ka", limit=2000)
# Convert to pandas DataFrame
df = pd.DataFrame.from_records(Results)
答案 1 :(得分:0)
对于Python,非官方的sodapy库是一个很好的起点!