A Python module to interact with Lariat API to access data quality metrics and diagnostics
Project description
Lariat Python SDK
A Python module to interact with Lariat API and perform various operations like querying indicators, fetching datasets, etc.
Installation
To install the package, run the following command:
pip install lariat_python_sdk
Usage
First, import the necessary components:
from lariat_client import configure, get_raw_datasets, get_datasets, get_indicators, get_indicator, query, Filter, FilterClause
import datetime
Set up your API key and application key:
API_KEY = "your-api-key"
APP_KEY = "your-app-key"
configure(api_key=API_KEY, application_key=APP_KEY)
Get raw datasets:
raw_datasets = get_raw_datasets(dataset_ids=[1, 2, 3])
Get computed datasets:
datasets = get_datasets()
Get indicators:
indicators = get_indicators(datasets=datasets)
Get a specific indicator:
indicator = get_indicator(id=1)
Query an indicator:
from_ts = datetime.datetime(2022, 1, 1)
to_ts = datetime.datetime(2022, 2, 1)
group_by = ["country"]
filter_clause = FilterClause(field="country", operator="in", values=["US", "UK"])
query_filter = Filter(clauses=[filter_clause], operator="and")
results = query(indicator["id"], from_ts, to_ts, group_by, query_filter=query_filter)
# Convert results to a DataFrame
results_df = results.to_df()
# Save results to a CSV file
results.to_csv("results.csv")
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Close
Hashes for lariat_python_sdk-0.1.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 23a098c60c6a9656e8615685d0ab4f487b645d1ff7165e9ea8196e147b6466c7 |
|
MD5 | d00755a7a7dcd803466b35ff05c530fb |
|
BLAKE2b-256 | 7e1c45c3ca2b60ed3900b719fa606a163e9284676674cf7deda308c678da6d6d |