spooq.transformer.mapper_custom_data_types._generate_select_expression_for_StringBoolean

_generate_select_expression_for_StringBoolean(source_column, name)[source]

Deprecated!

Please use :dt.:~spooq.transformer.mapper_transformations.has_value instead.

Used for Anonymizing. The column’s value will be replaced by "1" if it is:

  • not NULL and

  • not an empty string

Example

>>> from pyspark.sql import Row
>>> from spooq.transformer import Mapper
>>>
>>> input_df = spark.createDataFrame(
>>>     [Row(email=u'tsivorn1@who.int'),
>>>      Row(email=u''),
>>>      Row(email=u'gisaksen4@skype.com')]
>>> )
>>>
>>> mapping = [("email", "email", "StringBoolean")]
>>> output_df = Mapper(mapping).transform(input_df)
>>> output_df.head(3)
[Row(email=u'1'), Row(email=None), Row(email=u'1')]