* RandomLocationGenerator
The RandomLocationGenerator
creates realistic GPS coordinates from a list of countries. It transforms the real data by dropping all the GPS-related columns. Then when reverse transforming, it generates random, realistic coordinates from around the world. Use this transformer when you want to completely anonymize your coordinates.

from rdt.transformers.gps import RandomLocationGenerator
transformer = RandomLocationGenerator(
locales=['en_US', 'fr_CA'],
missing_value_generation='random')
Parameters
locales
: An optional list of locales to use when generating GPS coordinates. All coordinates will be chosen from the list of available countries
missing_value_generation
: Add this argument to determine how to recreate missing values during the reverse transform phase
(default) 'random'
Randomly assign missing values in roughly the same proportion as the original data.
None
Do not recreate missing values.
Examples
from rdt.transformers.gps import RandomLocationGenerator
transformer = RandomLocationGenerator(
locales=['en_US', 'fr_CA'],
missing_value_generation='random'
)
# in the hypertransformer, ensure that each column has a supported sdtype
ht.update_sdtypes(column_name_to_sdtype={
'user_lat': 'latitude',
'user_lon': 'longitude',
})
# in the hypertransformer, assign set of columns to your transformer
ht.update_transformers(column_name_to_transformer={
('user_lat', 'user_lon'): transformer
})
FAQs
Worldwide, regional data is provided by www.geonames.org.
Last updated