Skip to content

Feature

Feature

Feature(table_name: str, trust_cache: bool = False)

Assemble a single harmonized DataFrame for a table across countries.

Parameters:

Name Type Description Default
table_name str

The table to load (e.g. 'household_roster', 'cluster_features').

required
trust_cache bool

If True, read existing cached parquets without validation (fast). Can be overridden per-call. Default False.

False

Examples:

>>> import lsms_library as ll
>>> roster = ll.Feature('household_roster')
>>> roster.countries          # which countries have this table
>>> df = roster(['Mali', 'Uganda'])  # load specific countries
>>> df = roster()                    # load all available countries
>>> df = roster(trust_cache=True)    # fast read from cache

countries property

countries: list[str]

Countries that declare this table in their data_scheme.yml.

columns property

columns: list[str]

Required columns from the global data_info.yml for this table.

__call__

__call__(countries: list[str] | None = None, trust_cache: bool | None = None) -> pd.DataFrame

Load and concatenate data across countries.

Parameters:

Name Type Description Default
countries list of str

Countries to include. Defaults to all available countries.

None
trust_cache bool

If True, read existing cached parquets without validation. Defaults to the instance-level setting from __init__.

None

Returns:

Type Description
DataFrame

DataFrame with a country index level prepended.