spooq.transformer.mapper_custom_data_types._generate_select_expression_for_IntBoolean
- _generate_select_expression_for_IntBoolean(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 contains a non-NULL value.Example
>>> from pyspark.sql import Row >>> from spooq.transformer import Mapper >>> >>> input_df = spark.createDataFrame( >>> [Row(facebook_id=3047288), >>> Row(facebook_id=0), >>> Row(facebook_id=None)] >>> ) >>> >>> mapping = [("facebook_id", "facebook_id", "IntBoolean")] >>> output_df = Mapper(mapping).transform(input_df) >>> output_df.head(3) [Row(facebook_id=1), Row(facebook_id=1), Row(facebook_id=None)]
Note
0
(zero) or negative numbers are still considered as valid values and therefore converted to1
.