RandomTransformer#

synthesized.privacy.RandomTransformer

class RandomTransformer(name, str_length=10)#

Transforms by generating a random string with slight format consistency.

Examples

“49050830L” -> “L3n8o3H2M”

name#

the data frame column to transform.

Type

str

str_length#

length of the string to be generated.

Type

int

Methods

fit(df)

Fits the given dataframe to the transformer

fit_transform(df)

rtype

DataFrame

from_meta(meta)

Construct a Transformer from a transformer class name and a meta.

from_name_and_meta(class_name, meta)

Construct a Transformer from a transformer class name and a meta.

get_registry()

rtype

Dict[str, Type[TypeVar(TransformerType, bound= Transformer)]]

inverse_transform(df, **kwargs)

Inverse transforms the transformed dataframe to give the original dataset

is_fitted()

rtype

bool

transform(df, **kwargs)

Transforms the given dataframe using fitted transformer

Attributes

in_columns

rtype

List[str]

out_columns

rtype

List[str]

fit(df)#

Fits the given dataframe to the transformer

Parameters

df (DataFrame) – Dataset to fit

Return type

RandomTransformer

Returns

self

classmethod from_meta(meta)#

Construct a Transformer from a transformer class name and a meta. This is an abstract class, must be implemented in each transformer subclass.

Return type

RandomTransformer

classmethod from_name_and_meta(class_name, meta)#

Construct a Transformer from a transformer class name and a meta.

See also

Transformer.from_meta: construct a Transformer from a meta

Return type

Transformer

inverse_transform(df, **kwargs)#

Inverse transforms the transformed dataframe to give the original dataset

Parameters

df (DataFrame) – Transformed dataset

Return type

DataFrame

Returns

Original dataset

transform(df, **kwargs)#

Transforms the given dataframe using fitted transformer

Parameters

df (DataFrame) – Dataset to transform

Return type

DataFrame

Returns

Transformed dataset