Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-14-2022 05:27 AM
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))