-
Notifications
You must be signed in to change notification settings - Fork 0
Package : Transform : ISO 3166 Class
Nuwan Waidyanatha edited this page Sep 15, 2023
·
3 revisions
from rezaware.modules.etl.transform import isoAlphaCodes as iso
The transformation package offers functions to find and reverse engineer ISO 3166 country and subdivision codes.
Augments columns with the requested ISO codes.
get_iso_3166(
data : any, # any dataset that can be transformed into pyspark DataFrame
t_iso: dict, # dictionary defining the transformation
)
- The input dataset must be one that can be converted to a pyspark DataFrame
- The Transformation dictionary must indicate
- whether it is COUNTRY (3166-1) or SUBDIV (3166-2) transformation
- specify the attribute name key: ATTRNAME along with the column name
- indicate the the requested TRANSFORMATION with a dictionary; where the key: ALPHA2, ALPHA2, UN, CODE is the transformation and the value is the return results column name
- Example:
"COUNTRY": {
"ATTRNAME" : 'the_country',
"TRANSFORM" : {
"ALPHA2" : 'country_3166_alpha2',
"ALPHA3" : 'country_3166_alpha3',
"UN" : 'country_un_code'
}
},
- Return the results in the columns (if specified, else in default columns)
the_country | country_3661_alpha2 | country_3661_alpha3 | country_un_code
Egypt | EG | EGY | 818
Rezaware abstract BI augmented AI/ML entity framework © 2022 by Nuwan Waidyanatha is licensed under Creative Commons Attribution 4.0 International