How do we compute effective tax rate from order subtotal and round the result to 4 decimal places?
Combining Column division with the built-in round() SQL function inside a select projection.
Precision accounting calculations, financial reporting, and tax audit compliance pipelines.
from pyspark.sql.functions import col, round
df.select(
col("order_id"),
round(col("tax_amount") / col("subtotal"), 4).alias("tax_rate")
).show()Practice typing production-grade PySpark code for Selecting Transformed & Rounded Columns.