openaq.OpenAQ.countries

OpenAQ.countries(**kwargs)[source]

Returns a listing of all countries within the platform

Parameters:
  • order_by (string or list) – order by one or more fields (ex. order_by=[‘cities’, ‘locations’]). Default value is ‘country’
  • sort (string) – define the sort order for one or more fields (ex. sort=’desc’)
  • limit (int) – change the number of results returned. Max is 10000. Default is 100.
  • page (int) – paginate through results. Default is 1.
  • df (bool) – return the results as a pandas DataFrame
  • index (string) – if returning as a DataFrame, set index to (‘utc’, ‘local’, None). The default is local
Returns:

dictionary containing the code, name, count, cities, and number of locations.

Example:
>>> import openaq
>>> api = openaq.OpenAQ()
>>> status, resp = api.countries()
>>> resp['results']
[
    {
        "cities": 174,
        "code": "AT",
        "count": 121987,
        "locations": 174,
        "name": "Austria"
    },
    {
        "cities": 28,
        "code": "AU",
        "count": 1066179,
        "locations": 28,
        "name": "Australia",
    },
    ...
]