Skip to content

Country filter

CountryFilter #

CountryFilter(country_codes: list[str])

Bases: RapidataFilter

CountryFilter Class

Can be used to filter who to target based on country codes.

Parameters:

Name Type Description Default
country_codes list[str]

List of country codes (capizalized) to filter by.

required
Source code in src/rapidata/rapidata_client/filter/country_filter.py
def __init__(self, country_codes: list[str]):
    # check that all characters in the country codes are uppercase
    if not isinstance(country_codes, list):
        raise ValueError("Country codes must be a list")

    if not all([code.isupper() for code in country_codes]):
        raise ValueError("Country codes must be uppercase")

    self.country_codes = country_codes