Load a supplementary dataset distributed with countrycode.

def load_dataset(
  name: str,
  as_type: Literal["dict", "pandas", "polars"] = "dict"
)

Arguments

nameDataset name. Valid values are "codelist_panel", "countryname_dict", and "cldr_examples".
as_typeOutput representation: "dict", "pandas", or "polars".

Value

A mapping of column names to lists, a Pandas DataFrame, or a Polars DataFrame, depending on as_type.

Raises

ValueErrorIf name or as_type is invalid.
ImportErrorIf the requested optional DataFrame library is not installed.

Examples

panel = load_dataset("codelist_panel")
len(panel["year"]) > 1000