Exercise

Custom Percentage Scaling

In the slides we showed how to scale the data between 0 and 1. Sometimes you may wish to scale things differently for modeling or display purposes.

Instructions

100 XP
  • Calculate the max and min of DAYSONMARKET and put them into variables max_days and min_days, don't forget to use collect() on agg().
  • Using withColumn() create a new column called 'percentagescaleddays' based on DAYSONMARKET.
  • percentage_scaled_days should be a column of integers ranging from 0 to 100, use round() to get integers.
  • Print the max() and min() for the new column percentage_scaled_days.