pyspark.sql.functions.lit

pyspark.sql.functions.lit(col)[source]

Creates a Column of literal value.

New in version 1.3.0.

Examples

>>> df.select(lit(5).alias('height')).withColumn('spark_user', lit(True)).take(1)
[Row(height=5, spark_user=True)]