Get places
Sometimes you want to know what places belong to a particular category, rather than resolving or filtering
places. bblocks-places makes it easy to get list of places that fit different categories.
For example, you want to know what countries are official UN member states or all African countries. You can use the
get_places function to do this.
african_countries = places.get_places({"region": "Africa"}, place_format="name_official")
print(african_countries)
# Output:
# ['Algeria', 'Angola', 'Benin', 'Botswana', 'British Indian Ocean Territory', 'Burkina Faso', .... ]
You may have noticed that the previous example contains some countries and some territories (such as
British Indian Ocean Territory). The default concordance table used maps countries to different formats
according to those available in the M49 list of countries and some additional countries/territories such as
Taiwan. To see the full concordance table as a pandas DataFrame use the get_default_concordance_table function.
You can also get places that fit into multiple categories. Using the previous example, let's say we want all African countries that are UN member states.
africa_un_members = places.get_places({"region": "Africa", "un_member": True},
place_format="name_official")
print(africa_un_members)
# Output:
# # ['Algeria', 'Angola', 'Benin', 'Botswana', 'Burkina Faso', .... ]
The entire list of filters available is:
region- UN region nameregion_code- UN region codesubregion- UN subregionsubregion_code- UN subregion codeintermediate_region_code- UN intermediate region codeintermediate_region- UN intermediate region nameincome_level- World Bank income levelm49_member- M49 country list member (True if member)ldc- Less developed countrylldc- Land locked less developed countrysids- Small Island Developing Stateun_member- UN official memberun_observer- UN observer stateun_former_member- UN former member state
Convenience functions
Several convenience functions exist to get places for common categories:
get_un_members- get all official UN membersget_un_observers- get all UN observer statesget_m49_places- get all M49 placesget_sids- get all Small Island Developing Statesget_ldc- get all Least Developed Countriesget_lldc- get all Landlocked Developing Countriesget_african_countries- get all African countries