data.loaders
data.loaders
Load data
Functions
| Name | Description |
|---|---|
| get_age_distribution | Load age distribution for a given country or countries. |
| get_country_aliases | Define aliases for countries with odd names in the data |
| get_household_size | Load household size distribution for a given country or countries. |
| map_entries | Find a match between the JSON file and the provided location(s). |
| show_locations | Print a list of available locations. |
get_age_distribution
data.loaders.get_age_distribution(location=None)Load age distribution for a given country or countries.
Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| location | str or list | name of the country or countries to load the age distribution for | None |
Returns
| Name | Type | Description |
|---|---|---|
| age_data | array | Numpy array of age distributions, or dict if multiple locations |
get_country_aliases
data.loaders.get_country_aliases()Define aliases for countries with odd names in the data
get_household_size
data.loaders.get_household_size(location=None)Load household size distribution for a given country or countries.
Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| location | str or list | name of the country or countries to load the household size distribution for | None |
Returns
| Name | Type | Description |
|---|---|---|
| house_size | float | Size of household, or dict if multiple locations |
map_entries
data.loaders.map_entries(json, location)Find a match between the JSON file and the provided location(s).
Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| json | list or dict | the data being loaded | required |
| location | list or str | the list of locations to pull from | required |
show_locations
data.loaders.show_locations(location=None, output=False)Print a list of available locations.
Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| location | str | if provided, only check if this location is in the list | None |
| output | bool | whether to return the list (else print) | False |
Examples::
cv.data.show_locations() # Print a list of valid locations
cv.data.show_locations('lithuania') # Check if Lithuania is a valid location
cv.data.show_locations('Viet-Nam') # Check if Viet-Nam is a valid location