download_data() is the SDK’s main read method. Call it on a per-dataset handle to retrieve the dataset’s rows in the format of your choice. The method also supports server-side filtering by date range, entity values, and column subset — saving bandwidth and post-processing for large datasets.
You only need read permission on a dataset to download it. For public datasets that you don’t own, look the dataset ID up in the URL on alphacast.io and pass it directly to
dataset().Output formats
Pass theformat argument to choose how the data is returned:
format | Returns | Use it when |
|---|---|---|
"pandas" | pandas.DataFrame | Working in a notebook or pipeline that consumes DataFrames. |
"csv" | bytes (CSV) | Saving to disk or piping into another tool. |
"json" | list[dict] | Iterating row-by-row in pure Python. |
"xlsx" | bytes (XLSX) | Producing an Excel file for non-technical users. |
"tsv" | bytes (TSV) | Tab-separated workflows. |
When
format="json" the API responds with newline-delimited JSON (NDJSON). The SDK parses it for you and returns a flat list of dicts — one dict per row.Filtering by date range
PassstartDate and/or endDate as datetime.date (or datetime.datetime) objects to restrict the rows returned:
Filtering by entity values
UsefilterEntities to restrict rows by the value of one or more entity columns. Pass a dict mapping each entity column to a list of accepted values:
Selecting specific columns
UsefilterVariables to keep only certain value columns in the output. Entity and date columns are always returned automatically.
Column names must match the names in the dataset schema exactly (case-sensitive). Use
get_column_definitions() to inspect the available columns first.Combining filters
All three filters compose. The example below downloads US and Argentine GDP from 2020 onwards as a DataFrame:Method signature
One of
"csv", "json", "xlsx", "tsv", or "pandas". The first four return the raw bytes (or list of dicts for JSON); "pandas" returns a DataFrame.Inclusive lower bound for the date column. The SDK detects the date column automatically.
Inclusive upper bound for the date column.
Column names to include. Entity and date columns are always included even if not listed.
Mapping of entity column name to accepted values. Multiple keys are AND’d; values within a key are OR’d.
Public datasets
You can download from any public dataset on Alphacast — even ones you don’t own — by passing its ID. Find the ID in the URL on alphacast.io (e.g./datasets/5208/... → ID 5208).
Next steps
- Discover dataset IDs across the catalog with Search.
- Read
download_dataREST reference for the underlying OData parameters.