How do we construct an end-to-end data cleansing pipeline combining filtering, imputation, and coalesce?
A composite cleansing pipeline dropping corrupt IDs, imputing numeric defaults, and coalescing trimmed text.
Silver-layer transaction processing pipelines in enterprise data warehouses.
from pyspark.sql.functions import col, coalesce, lit, trim
clean_df = df \
.filter(col("transaction_id").isNotNull()) \
.fillna({"quantity": 1, "currency": "USD"}) \
.withColumn("vendor", coalesce(trim(col("vendor_name")), lit("DIRECT")))Practice typing production-grade PySpark code for Production Robust NULL Sanitation Pipeline.