AmanSehgal
Honored Contributor III

Because it's a for loop, and in the last loop column measure3 is selected. The variable rounding is assigned a new dataframe with changes that occur on column measure3 only.

Try the following code:

rounding = test1
for i in col_list:
  rounding = rounding\
    .withColumn(i, round(col(i),0))

View solution in original post