How do we round salary numbers in-place to 2 decimal places without creating new column names?
Passing an existing column name to withColumn() replaces the original column with the transformed expression.
In-place data sanitization, rounding currency values, and replacing raw text with clean tokens.
from pyspark.sql.functions import col, round
df = df.withColumn("salary", round(col("salary"), 2))Practice typing production-grade PySpark code for Overwriting Existing Columns with Transformations.