# ＊ RegionalAnonymizer

{% hint style="info" %}
**＊SDV Enterprise Feature.** This feature is available to our licensed users and is not currently in our public library. For more information, visit our page to [Explore SDV](https://docs.sdv.dev/sdv/explore/sdv-enterprise/compare-features).
{% endhint %}

The `RegionalAnonymizer` performs Contextual Anonymization on address data. It preserves the broad regions in your original data, while anonymizing the precise street address.

It transforms the data by dropping the precise location information. When reverse transforming, it generates new, fake street addresses for the same overall regions as your real data.&#x20;

<figure><img src="https://2225246359-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FVGX92M819eIp0rMg5elc%2Fuploads%2FR2BKeVUKgUGQZKEE07Gt%2Frdt_transformers-glossary-deep-data-understanding-address-regional-anonymizer_June%2002%202025.png?alt=media&#x26;token=93c4ff54-4406-4b38-a01c-63e5af87f989" alt=""><figcaption></figcaption></figure>

```python
from rdt.transformers.address import RegionalAnonymizer

transformer = RegionalAnonymizer(locales=['en_US'])
```

## Parameters

**`locales`**: An optional list of locales to use when generating the precise street addresses. These will be chosen from the list of available countries with the provided languages.&#x20;

<table data-header-hidden><thead><tr><th width="211.5"></th><th></th></tr></thead><tbody><tr><td>(default) <code>["en_US"]</code></td><td>Create precise, street-level data from the US in English.</td></tr><tr><td><code>&#x3C;list></code></td><td>Create precise, street-level data from the list of countries specified in the languages specified.<br><br>For example <code>[</code><a href="https://faker.readthedocs.io/en/master/locales/en_US.html"><code>"en_US"</code></a><code>,</code> <a href="https://faker.readthedocs.io/en/master/locales/fr_CA.html"><code>"fr_CA"</code></a><code>]</code> creates a mix of locations from the US in English and from Canada in French.</td></tr></tbody></table>

## Examples

{% hint style="info" %}
**This transformer takes multiple columns as input.** Make sure that each column involved in your address is a supported sdtype such as `city`, `state` and `postcode`. For more information, see the [suported sdtypes list](https://docs.sdv.dev/rdt/transformers-glossary/deep-data-understanding/address/..#supported-sdtypes).
{% endhint %}

```python
from rdt.transformers.address import RegionalAnonymizer

transformer = RegionalAnonymizer(
    locales=['en_US', 'fr_CA']
)

# in the hypertransformer, ensure that each column has a supported sdtype
ht.update_sdtypes(column_name_to_sdtype={
    'addr_1': 'street_address',
    'city_name': 'city',
    'state': 'state_abbr',
})

# in the hypertransformer, assign set of columns to your transformer
ht.update_transformers(column_name_to_transformer={
    ('addr_1', 'city_name', 'state'): transformer
})

```

## FAQs

<details>

<summary>Will the generated locations be real places?</summary>

The general region is guaranteed to be real. That is, the combination of the city, administrative unit, country, and post code can be found on a map. For example: `Boston, MA USA 02116`.&#x20;

However, anything more precise than that will be fake, including street address and secondary address. For example: `123 Main St., Suite #204` is completely made up and not necessarily located in Boston. This is by design to help protect the privacy of real homes and businesses.

</details>

<details>

<summary>Will this transformer create broad areas that are not in my original data?</summary>

This transformer is designed to only generate the broader areas that are in your original data. For example, if your original data only contained addresses from California and New York, then the anonymized addresses will also only contain these regions. It will not contain any other city such as Boston.

If you'd like to create addresses from new locations, use the [RandomLocationGenerator](https://docs.sdv.dev/rdt/transformers-glossary/deep-data-understanding/address/randomlocationgenerator).

</details>

*Worldwide, regional data is provided by* [*www.geonames.org*](https://www.geonames.org)*.*
