PySpark - Add Column with Constant/Literal Value
• Use lit() from pyspark.sql.functions to add constant values to PySpark DataFrames—it handles type conversion automatically and works seamlessly with the Catalyst optimizer
• Use lit() from pyspark.sql.functions to add constant values to PySpark DataFrames—it handles type conversion automatically and works seamlessly with the Catalyst optimizer