datacommons-client
Work with Data Commons, a platform providing programmatic access to public statistical data from global sources. Use this skill when working with demographic data, economic indicators, health statistics, environmental data, or any public datasets available through Data Commons.
Installation
Pick a client and clone the repository into its skills directory.
Installation
About this skill
Work with Data Commons, a platform providing programmatic access to public statistical data from global sources. Use this skill when working with demographic data, economic indicators, health statistics, environmental data, or any public datasets available through Data Commons. Applicable for querying population statistics, GDP figures, unemployment rates, disease prevalence, geographic entity resolution, and exploring relationships between statistical entities.
How to use
Zainstaluj klienta Data Commons za pomocą menedżera pakietów: uruchom
uv pip install "datacommons-client[Pandas]"(z obsługą Pandas) lubuv pip install datacommons-client(wersja podstawowa).Zaimportuj klienta w swoim skrypcie:
from datacommons_client import DataCommonsClienti utwórz instancjęclient = DataCommonsClient().Użyj endpointu Observation do pobrania danych statystycznych — określ zmienną (np.
Count_Persondla populacji), identyfikator jednostki (np.geoId/06dla Kalifornii) i datę (latestdla najnowszych danych lub zakres dla szeregów czasowych).Wywołaj metodę
client.observation.fetch()z parametrami:variable_dcids(lista zmiennych),entity_dcids(lista jednostek) idate(data lublatest).Przetwórz zwrócone dane — odpowiedź zawiera obserwacje statystyczne dla wybranych jednostek i zmiennych, którymi możesz manipulować za pomocą Pandas lub innego narzędzia do analizy danych.
Dla bardziej zaawansowanych zapytań zapoznaj się z dokumentacją endpointów Knowledge Graph i Entity Resolution, aby eksplorować strukturę danych i rozwiązywać identyfikatory jednostek geograficznych.